sonixtwo Posted February 5, 2007 Share Posted February 5, 2007 On my product_info.php page, I would like to show an image with the price overlayed onto it. For this I am using the php gd library. The image is called by product_info.php: <?php echo tep_image(DIR_WS_IMAGES . 'custompic.php'); ?> custompic.php consists of valid code to display what I need, but the value for $products_price is displayed as zero. I imagine it has something to do with the variables to calculate $products_price not being carried over to custompic.php. How can I resolve this? Here is my custompic.php code: <?php header ("Content-type: image/png"); $im = imagecreatefrompng("coolbox.png"); $white = imagecolorallocate($im,255,255,255); $blue = imagecolorallocate($im,0,0,255); $red = imagecolorallocate($im, 255, 0, 0); $black = imagecolorallocate($im, 0, 0, 0); $px = (imagesx($im)/2); imagestring($im, 3, $px, 9, $products_price, $red); imagepng($im); imagedestroy($im); ?> Any help would be appreciated. Thanks! -Mike Link to comment Share on other sites More sharing options...
sonixtwo Posted February 8, 2007 Author Share Posted February 8, 2007 On my product_info.php page, I would like to show an image with the price overlayed onto it. For this I am using the php gd library. The image is called by product_info.php: <?php echo tep_image(DIR_WS_IMAGES . 'custompic.php'); ?> custompic.php consists of valid code to display what I need, but the value for $products_price is displayed as zero. I imagine it has something to do with the variables to calculate $products_price not being carried over to custompic.php. How can I resolve this? Here is my custompic.php code: <?php header ("Content-type: image/png"); $im = imagecreatefrompng("coolbox.png"); $white = imagecolorallocate($im,255,255,255); $blue = imagecolorallocate($im,0,0,255); $red = imagecolorallocate($im, 255, 0, 0); $black = imagecolorallocate($im, 0, 0, 0); $px = (imagesx($im)/2); imagestring($im, 3, $px, 9, $products_price, $red); imagepng($im); imagedestroy($im); ?> Any help would be appreciated. Thanks! -Mike I have the idea to append the sid to the end of echo tep_image(DIR_WS_IMAGES . 'custompic.php') and the incude application_top to custompic.php. Hopefully this works. Still hoping for some input. Thanks! Link to comment Share on other sites More sharing options...
Velveeta Posted February 8, 2007 Share Posted February 8, 2007 I have the idea to append the sid to the end of echo tep_image(DIR_WS_IMAGES . 'custompic.php') and the incude application_top to custompic.php. Hopefully this works. Still hoping for some input. Thanks! Just include the price as part of the url being called, so it looks like this: <?php echo tep_image(DIR_WS_IMAGES . 'custompic.php?price=' . urlencode($products_price)); ?> And this: <?php header ("Content-type: image/png"); $im = imagecreatefrompng("coolbox.png"); $white = imagecolorallocate($im,255,255,255); $blue = imagecolorallocate($im,0,0,255); $red = imagecolorallocate($im, 255, 0, 0); $black = imagecolorallocate($im, 0, 0, 0); $px = (imagesx($im)/2); $products_price = urldecode($_GET['price']); imagestring($im, 3, $px, 9, $products_price, $red); imagepng($im); imagedestroy($im); ?> Richard. Richard Lindsey Link to comment Share on other sites More sharing options...
sonixtwo Posted February 8, 2007 Author Share Posted February 8, 2007 Just include the price as part of the url being called, so it looks like this: <?php echo tep_image(DIR_WS_IMAGES . 'custompic.php?price=' . urlencode($products_price)); ?> And this: <?php header ("Content-type: image/png"); $im = imagecreatefrompng("coolbox.png"); $white = imagecolorallocate($im,255,255,255); $blue = imagecolorallocate($im,0,0,255); $red = imagecolorallocate($im, 255, 0, 0); $black = imagecolorallocate($im, 0, 0, 0); $px = (imagesx($im)/2); $products_price = urldecode($_GET['price']); imagestring($im, 3, $px, 9, $products_price, $red); imagepng($im); imagedestroy($im); ?> Richard. Thank you very much, that worked perfectly! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.