ShoeLace1291 Posted September 11, 2011 Share Posted September 11, 2011 I want to create an image using pre-existing image files. I want to use more than one file, otherwise I would use the imagecreatefromjpg function. What function should I use to create an image using a for statement to determine how many of each image is being displayed in the new image? Quote Link to comment https://forums.phpfreaks.com/topic/246890-creating-images/ Share on other sites More sharing options...
marcelobm Posted September 11, 2011 Share Posted September 11, 2011 this script will create an image from 5 different sources. // Create image instances $src = imagecreatefromjpeg('images/desert.jpg'); $src1 = imagecreatefromjpeg('images/koala.jpg'); $src2 = imagecreatefromjpeg('images/lighthouse.jpg'); $src3 = imagecreatefromjpeg('images/Penguins.jpg'); $src4 = imagecreatefromjpeg('images/jellyfish.jpg'); $dest = imagecreatetruecolor(500, 100); // Copy imagecopy($dest, $src, 0, 0, 500, 500, 100, 100); imagecopy($dest, $src1, 100, 0, 500, 500, 100, 100); imagecopy($dest, $src2, 200, 0, 500, 500, 100, 100); imagecopy($dest, $src3, 300, 0, 500, 500, 100, 100); imagecopy($dest, $src4, 400, 0, 500, 500, 100, 100); // Output and free from memory header('Content-Type: image/jpg'); imagejpeg($dest); imagedestroy($dest); imagedestroy($src); imagedestroy($src1); imagedestroy($src2); imagedestroy($src3); imagedestroy($src4); Quote Link to comment https://forums.phpfreaks.com/topic/246890-creating-images/#findComment-1267934 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.