dig412 Posted February 26, 2006 Share Posted February 26, 2006 I'm using this code to make a simple speech bubble generator, and so far its working fine. However, if you choose 'save image' in firefox, it will save the blank image without the added text. It saves properly in ie, so i dont know exactly whats wrong.[code]if (isset($_GET['mode'])){if ($_GET['mode'] == "img") { header ("Content-type: image/jpeg"); header('Content-transfer-encoding: binary'); putenv('GDFONTPATH=' . realpath('.')); $image = $_POST['image']; if ($image == "shout") { $img_handle = @ImageCreateFromJPEG ("domotalk.jpg"); } else{ $img_handle = @ImageCreateFromJPEG ("domonews.jpg"); } $txt_color = ImageColorAllocate ($img_handle, 0, 0, 0); $text = $_POST['usertxt']; if ($image == "shout") { $newtext = wordwrap($text, 17, "\n", 1); } else { $newtext = wordwrap($text, 20, "\n", 1); } $font = 'arial'; if ($image == "shout") { ImageTTFText ($img_handle, 14, 0, 207, 62, $txt_color, $font,"$newtext"); } else { ImageTTFText ($img_handle, 14, 0, 280, 75, $txt_color, $font,"$newtext"); } ImageJPEG ($img_handle,'',95); } } [/code]I'm assuming that it's got something to do with the headers.Any ideas?EDIT:It seems it doesn;t work with IE anymore. hmm Quote Link to comment Share on other sites More sharing options...
RussellReal Posted December 30, 2008 Share Posted December 30, 2008 [code]<? if (isset($_GET['mode'])){ if ($_GET['mode'] == "img") { header ("Content-type: image/jpeg"); header('Content-transfer-encoding: binary'); putenv('GDFONTPATH=' . realpath('.')); $image = $_POST['image']; $text = $_POST['usertxt']; $txt_color = ImageColorAllocate($img_handle, 0, 0, 0); $font = 'arial'; $img_handle = @ImageCreateFromJPEG((($image == "shout")? "domotalk":"domonews").".jpg"); if ($image == "shout") { $newtext = wordwrap($text, 17, "\n", 1); ImageTTFText($img_handle, 14, 0, 207, 62, $txt_color, $font, $newtext); } else{ $newtext = wordwrap($text, 20, "\n", 1); ImageTTFText($img_handle, 14, 0, 280, 75, $txt_color, $font, $newtext); } ImageJPEG ($img_handle,NULL,95); } } ?>[/code]only problem I can see is $font is being set to 'arial' and 'arial' is not a font file.. the font parameter for imagettftext is a FONT FILENAMEyes I know this post is over 2 yrs old.. whatever.. I'm bored 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.