jmrosenwald Posted December 2, 2007 Share Posted December 2, 2007 Hey guys What function would I use to portray a different image on a php parsed .png file? I want to layer the images I guess. Is there a function like imagestring I could use to draw a image? Thanks Joe Quote Link to comment Share on other sites More sharing options...
mr_mind Posted December 2, 2007 Share Posted December 2, 2007 i cannot exactly tell what you mean but to display a different file if a php file is parsed you would do this: <?php $somefile = "image1.png"; $anotherfile = "image2.gif"; if($_FILES[$somefile]['type']=="image/png") { print '<img src=' . $otherfile . ' />'; } else { print '<img src=' . $somefile . ' />'; } ?> Quote Link to comment Share on other sites More sharing options...
jmrosenwald Posted December 2, 2007 Author Share Posted December 2, 2007 What I want to do is display a smaller png in the png i create from this imagepng() Quote Link to comment Share on other sites More sharing options...
mr_mind Posted December 2, 2007 Share Posted December 2, 2007 try this:L http://us2.php.net/manual/en/function.imagecopyresized.php Quote Link to comment Share on other sites More sharing options...
jmrosenwald Posted December 2, 2007 Author Share Posted December 2, 2007 I can't figure out how to use that correctly. Let me show you: http://www.renaxgade.net/sigs/tictactoe.png That is a board created from php. I want to display X's and O's on it (jpg's) if the right get variable is passed. imagecopyresized($image, "http://renaxgade.net/sigs/x.jpg", 0, 0, 0, 0, 108, 108, 432, 432); So 108x108 = size of image I want to import onto the bigger image, which is 432x432. It should place it at the top left corner. However, I just get an error and it won't spit the image back. Thanks again Joe Quote Link to comment Share on other sites More sharing options...
jmrosenwald Posted December 2, 2007 Author Share Posted December 2, 2007 bump Quote Link to comment Share on other sites More sharing options...
tippy_102 Posted December 2, 2007 Share Posted December 2, 2007 However, I just get an error and What is the error message? I would use imagecopymerge - you're doing the same thing as a watermark so... imagecopymerge($image, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height, 100); Quote Link to comment Share on other sites More sharing options...
mr_mind Posted December 19, 2007 Share Posted December 19, 2007 Try this code. It may be that the value of the source is broken somewhere so i laid it out nicely. It should create a new image called x_s.jpg in you source directory. <?php // The image sources $dst_image = $_SERVER['DOCUMENT_ROOT'] . '/sigs/x_s.jpg'; $src_image = $_SERVER['DOCUMENT_ROOT'] . '/sigs/x.jpg'; // the destination coordinates $dst_x = '0'; $dst_y = '0'; // the source coordinates $src_x = '0'; $src_y = '0'; // the new image size $dst_w = '108'; $dst_h = '108'; // the source image size $src_w = imagesx($src_image); $src_h = imagesy($src_image); //the function imagecopyresized($dst_image,$src_image,$dst_x,$dst_y,$src_x,$src_y,$dst_w,$dst_h,$src_w,$src_h ); ?> Quote Link to comment 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.