Ruth Posted April 3, 2008 Share Posted April 3, 2008 i've got a script that will allow a user to enter text, select any image off their computer, and select a background. The idea is to make a postcard of sorts. I've got it working but it doesn't look very good. It just looks like one image was slapped onto another. Can anyone tell me how to get the users image to blend into the background so it looks like one image using php. Here is my code. <?php //get vars $image_caption = $_POST['image_caption']; $image_username = $_POST['image_username']; $image_tempname = $_FILES['image_filename']['name']; $today = date ("Y-m-d"); $destination = $_POST['destination']; //upload image and check for image type $ImageDir = "C:/projects/pratice/WWW/ch07/virtual_vacation/images/"; $ImageName = $ImageDir . $image_tempname; //get to see if upload was successful if (move_uploaded_file($_FILES['image_filename']['tmp_name'],$ImageName)) { //get info about image being uploaded list($width, $height, $type, $attr) = getimagesize($ImageName); //check if img is jpg if ($type <> 2) { echo "Sorry, but the file you uploaded was not a JPG file.<br />"; echo "Please hit your browsers back button and try again."; } else { //image is ok to proceed $dstfilename = $ImageDir . $destination . ".jpg"; //blend 2 imgs $image = imagecreatefromjpeg($ImageName); list($width2, $height2, $type2, $attr2) = getimagesize($dstfilename); $image2 = imagecreatefromjpeg($dstfilename); imagecopymerge($image2, $image,50,140,0,0, $width, $height, 100); } if ($image_caption ) { //add text on img imagettftext($image2, 12,0,20,20,0, "arial.ttf", $image_caption); } header("Content-type:image/jpeg"); imagejpeg($image2); } ?> Link to comment https://forums.phpfreaks.com/topic/99395-php-images/ Share on other sites More sharing options...
cooldude832 Posted April 3, 2008 Share Posted April 3, 2008 try exploring a pdf document. You might be able to take the images into a pdf and use some transparencies on layers and border up text etc. to get a cleaner look. GD isn't meant for super heavy image creation/manipulation. imagestick might also be useful Link to comment https://forums.phpfreaks.com/topic/99395-php-images/#findComment-508602 Share on other sites More sharing options...
Ruth Posted April 3, 2008 Author Share Posted April 3, 2008 There i no way to do this with php? Link to comment https://forums.phpfreaks.com/topic/99395-php-images/#findComment-508603 Share on other sites More sharing options...
cooldude832 Posted April 3, 2008 Share Posted April 3, 2008 There i no way to do this with php? Php can make pdfs and imagestick is a library extension read up on php.net Link to comment https://forums.phpfreaks.com/topic/99395-php-images/#findComment-508606 Share on other sites More sharing options...
Ruth Posted April 3, 2008 Author Share Posted April 3, 2008 ok thanks for your help Link to comment https://forums.phpfreaks.com/topic/99395-php-images/#findComment-508608 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.