dovgqc2648 2016-10-17 18:20
浏览 48

将imagecopyresampled上的新图像设置为100%宽度/高度

I am using a modified version of http://shanechism.com/code/2011/06/facebook-picture-overlay-script (demo here) to set a frame around a picture that the user uploads.

However, for the life of me I can't figure out how to set the frame to encompass the entire image (100% width / height), as opposed to appear as a 'watermark' on the bottom-left of the image.

I believe the answer lies in the following line of code:

imagecopyresampled( $tmp, $src, 0, 0, 0, 0, $new[0], $new[1],
    $this->uploadedInfo[0], $this->uploadedInfo[1] );

Anyone have any ideas? From what I've researched on Stackoverflow & beyond, the answer isn't as straight forward as I'd hope, but I thought I'd ask here just in-case.

Thanks

  • 写回答

1条回答 默认 最新

  • doushou8299 2016-10-17 18:42
    关注

    imagecopyresampled works like this

    bool imagecopyresampled ( resource $dst_image , resource $src_image , int $dst_x , int $dst_y , int $src_x , int $src_y , int $dst_w , int $dst_h , int $src_w , int $src_h )
    

    You can adjust your function $src_w, $src_h, $dst_w and $dst_h to be your desired width/height for the source/destination

    Full documentation here

    评论

报告相同问题?

悬赏问题

  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用
  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教