简体   繁体   中英

how to set max size for imagecreatetruecolor in PHP

When i create image like:

$new_image = imagecreatetruecolor(1700, 1200);

the image is created normal but when i set size abow 2000x2000 it could not created. How to change the limit value. I have a godaddy ultimate hosting. I have changed in PHP5.ini memory_limit = 300M but does not effect.

the my working code is:

$in_filename = "image/".$img3[6];

list($width, $height) = getimagesize($in_filename);


$dest = imagecreatefromjpeg('tsomog/'.$img3[6]);


list($width, $height) = getimagesize($dest);

$src = imagecreatefromjpeg('tsomog1/'.$img3[6]);

 list($width1, $height1) = getimagesize($src);



$new_image = imagecreatetruecolor(1700, 1200);

$white = imagecolorallocate($new_image, 255, 255, 255);
imagefill($new_image, 0, 0, $white);

imagecopy ($new_image, $src , 0 , 0 , 0 , 0 ,$new_width1, $new_height1);
imagecopy ($new_image, $dest , 0 , 0 , 0 , 0,$new_width, $new_height);

header('Content-Type: image/jpeg');
imagejpeg($new_image,"tsomog2/".$img3[6]);
imagedestroy($new_image);
imagedestroy($dest);
imagedestroy($src);

the $in_filename filesze is abow 2000x2000

Most probably this is not an issue of maxsize of imagecreatetruecolor . The issue here seems to be the memory allocation. Try and talk to your web hosting provider to get the memory increased,

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM