increasing image size with GD and PHP
i seem to be too dumb for开发者_如何学C this :-)
i have an image say x=200 y=200
i want the image to stay the same but include a footer watermark lets say a.jpg which has a height of 20
so i want a final image of 220 and y 200
i tried it this way but it wont work
$newimage=imagecreatetruecolor($width,$height+25);
imagecopy($newimage, $this->parentInstance->getOldImage(), 0, 0, 0, 0, $watermarksize[0], $watermarksize[1]);
imagecopy($newimage, $watermark, $dest_x, $dest_y, 0, 0, $watermarksize[0], $watermarksize[1]);
imagecopy($this->parentInstance->getOldImage(), $newimage, 0, 0, 0, 0, $dest_x, $dest_y);
You need to lookup imagecopymerge()
- http://php.net/manual/en/function.imagecopymerge.php
Look at image copy resized if you want to resize an image resource using the GD library.
精彩评论