Hi guys, i'm a php beginner

I was trying to create a function to merge two images into one. I have been successfully merging a frame(png) on top of an image uploaded (jpeg) on low res.

Then i move on to increase the image file size so that i have better resolution that can be print. I increase both my frame(.png / about 2.7mb) and image(.jpg / 1.9mb) resolution into 2048px * 1536px and when i run the exact same function by tweaking the following it doesn't work anymore. I also have an html form below the image preview ( which i mention above that doesn't display after i increase the image resolution ) also it no longer display.

imagecopy($image, $frame, 0, 0, 0, 0, 2048, 1536);

My code applies as shown below:

<?php
                $image = imagecreatefromstring(file_get_contents("img/source.jpg");
		$frame = imagecreatefrompng('img/frame_test.png');
		
		imagealphablending($frame, true);
		imagesavealpha($frame, true);
		
		imagecopy($image, $frame, 0, 0, 0, 0, 2048, 1536);
		
		header('Content-Type: image/png');
		
		imagejpeg($image, 'img/done.jpg');
		
		$photoframe = 'img/done.jpg';
		
		imagedestroy($image);
		imagedestroy($frame);
	?>
  <div id="preview">
  	<img class="preview-img" src="<?php echo $photoframe; ?>" alt="Your Image" title="Your Image" />
  </div>
  <div id="cust-form"> ...

Maybe it's a memory limit issue, i.e. the memory used by PHP scripts, did you get any error? If error reporting is disabled, place <?php error_reporting(E_ALL); ?> at top of the script and see what it happens.

Hi Cereal
Seems like memory limit issue :-)
It works fine after i change the maximum limit to 128M from php.ini.

Thank you for your help.

Image manipulation in php is always iffy, make sure that people can't keep hammering it or your server will grind to a halt.

Hi jbeneet,

thanks for your advice :D i will keep that in mind

Ok, if we've finished mark this thread as solved, bye :)