php GD Library imagecopyrezised()

瘦欲@ 提交于 2019-12-13 05:16:51

问题


I am using the following line to resize an image file:

imagecopyresized($dst_image, $dst_image, 0, 0, 0, 0, 1000, 750, $src_w, $src_h

I am expecting the values of 1000 and 750 to be the dimensions of the new image file, but instead, an image is being created with the same dimensions as the original file, and copying a section of this image back onto it.

Could anyone help?


回答1:


You should create a new image source and copy the image in there:

$resized = imagecreatetruecolor(1000, 750);
imagecopyresized($resized, $dst_image, 0, 0, 0, 0, 1000, 750, $src_w, $src_h)

See the docs: php.net/imagecopyresized



来源:https://stackoverflow.com/questions/19158174/php-gd-library-imagecopyrezised

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!