karthikanov24 Posted September 20, 2009 Share Posted September 20, 2009 How and where can we use the following statement of html coding, <img src="<?php echo $dest;?>"> and <img src="<?php eho $src;?>"> to get or see the image inside the php codes posted below <?php function copyImage($srcFile, $destFile, $w, $h, $quality = 75) { $tmpSrc = pathinfo(strtolower($srcFile)); $tmpDest = pathinfo(strtolower($destFile)); $size = getimagesize($srcFile); if ($tmpDest['extension'] == "gif" || $tmpDest['extension'] == "jpg") { $destFile = substr_replace($destFile, 'jpg', -3); $dest = imagecreatetruecolor($w, $h); imageantialias($dest, TRUE); } elseif ($tmpDest['extension'] == "png") { $dest = imagecreatetruecolor($w, $h); imageantialias($dest, TRUE); } else { return false; } echo $dest; switch($size[2]) { case 1: //GIF $src = imagecreatefromgif($srcFile); break; case 2: //JPEG $src = imagecreatefromjpeg($srcFile); break; case 3: //PNG $src = imagecreatefrompng($srcFile); break; default: return false; break; } imagecopyresampled($dest, $src, 0, 0, 0, 0, $w, $h, $size[0], $size[1]); switch($size[2]) { case 1: case 2: imagejpeg($dest,$destFile, $quality); break; case 3: imagepng($dest,$destFile); } return $destFile; } ?> ------------- Thanks, Karthikanov24 Quote Link to comment https://forums.phpfreaks.com/topic/174885-inserting-html-code-in-to-php-codings/ Share on other sites More sharing options...
RussellReal Posted September 20, 2009 Share Posted September 20, 2009 okay.. you CAN'T do what you're interested in, however, you CAN do it with a little run-around. create a php file and put that php code inside (the code that generates the image) THEN just do <img src='whateverThatPHPFileWasNamed.php' /> Quote Link to comment https://forums.phpfreaks.com/topic/174885-inserting-html-code-in-to-php-codings/#findComment-921672 Share on other sites More sharing options...
karthikanov24 Posted September 20, 2009 Author Share Posted September 20, 2009 hi thanks...Is that the php file look like this say name of the php file is abc.php <?php $dest=imagecreatetruecolor($w,$h); echo $dest; ?> and <img src> tag is used in the following funtion which is in another file....like this...at line 12 ? function copyImage($srcFile, $destFile, $w, $h, $quality = 75) { $tmpSrc = pathinfo(strtolower($srcFile)); $tmpDest = pathinfo(strtolower($destFile)); $size = getimagesize($srcFile); if ($tmpDest['extension'] == "gif" || $tmpDest['extension'] == "jpg") { $destFile = substr_replace($destFile, 'jpg', -3); $dest = imagecreatetruecolor($w, $h); imageantialias($dest, TRUE); echo "<img src="abc.php">"; } elseif ($tmpDest['extension'] == "png") { $dest = imagecreatetruecolor($w, $h); imageantialias($dest, TRUE); } else { return false; } could u give me the exact codings thru an example, please.. Thanks, karthikanov24 Quote Link to comment https://forums.phpfreaks.com/topic/174885-inserting-html-code-in-to-php-codings/#findComment-921689 Share on other sites More sharing options...
karthikanov24 Posted September 21, 2009 Author Share Posted September 21, 2009 put that php code Could you say me which code is that..please..? Thanks, karthikanov24 Quote Link to comment https://forums.phpfreaks.com/topic/174885-inserting-html-code-in-to-php-codings/#findComment-922117 Share on other sites More sharing options...
karthikanov24 Posted September 22, 2009 Author Share Posted September 22, 2009 hi may i know the reason ,why i am not getting the reply ?? Actually i want the codes that is to be putted inside that php file... thanks karthikanov24 Quote Link to comment https://forums.phpfreaks.com/topic/174885-inserting-html-code-in-to-php-codings/#findComment-922738 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.