RON_ron Posted March 23, 2010 Share Posted March 23, 2010 How to use imagecreatetruecolor() function to reconstruct an image from the string? Show me a example php code. Quote Link to comment https://forums.phpfreaks.com/topic/196197-reconstitute-the-image/ Share on other sites More sharing options...
The Little Guy Posted March 23, 2010 Share Posted March 23, 2010 http://beta.phpsnips.com/search.php?q=imagecreatetruecolor http://beta.phpsnips.com/snippet.php?id=61 http://beta.phpsnips.com/snippet.php?id=76 Quote Link to comment https://forums.phpfreaks.com/topic/196197-reconstitute-the-image/#findComment-1030333 Share on other sites More sharing options...
salathe Posted March 23, 2010 Share Posted March 23, 2010 from the string? What will the string contain? The binary image data, a path to a file, something else? Quote Link to comment https://forums.phpfreaks.com/topic/196197-reconstitute-the-image/#findComment-1030396 Share on other sites More sharing options...
RON_ron Posted March 23, 2010 Author Share Posted March 23, 2010 ofcourse the binary image data! Quote Link to comment https://forums.phpfreaks.com/topic/196197-reconstitute-the-image/#findComment-1030414 Share on other sites More sharing options...
maca134 Posted March 23, 2010 Share Posted March 23, 2010 If its already image binary data then you shouldn't need to use imagecreatetruecolor. Eg. If the binary data is a GIF header('Content-type: image/gif'); echo $binary_data; exit; That should do it Quote Link to comment https://forums.phpfreaks.com/topic/196197-reconstitute-the-image/#findComment-1030420 Share on other sites More sharing options...
RON_ron Posted March 23, 2010 Author Share Posted March 23, 2010 what I need to do is to convert the string to a image and send it via email. I need you guys help to write the PHP script. Quote Link to comment https://forums.phpfreaks.com/topic/196197-reconstitute-the-image/#findComment-1030425 Share on other sites More sharing options...
maca134 Posted March 23, 2010 Share Posted March 23, 2010 do you want to embed the image into the email or link it?? to link it, all you need to do is file_put_contents() to a lcation that is accessible to the web then link the image in the email "<img src='http://www.yourdomain.com/path/to/img' />" Embedding the image increase bandwidth on the server especially if your sending loads of emails. The best thing to do for embedding is take a look on www.phpclasses.org and find a mime email class, will make your life much easier Quote Link to comment https://forums.phpfreaks.com/topic/196197-reconstitute-the-image/#findComment-1030426 Share on other sites More sharing options...
RON_ron Posted March 23, 2010 Author Share Posted March 23, 2010 Yes I want to have the converted image (string) as an attachment. Do I have to add headders to do this. Could you please alter the code so it converts the string in to a image and sent as a attachment? This is my current code. <?PHP $to = "[email protected]"; $subject = "heading"; $headers = "From:" .$email."\r\n"; $message = "Name: " . $thename; $message .= "\nCompany : " . $thecompany; $sentOk = mail("$to",$subject,$message,$headers); echo "sentOk=" . $sentOk; ? Quote Link to comment https://forums.phpfreaks.com/topic/196197-reconstitute-the-image/#findComment-1030429 Share on other sites More sharing options...
maca134 Posted March 23, 2010 Share Posted March 23, 2010 Take a look at this: http://www.phpclasses.org/browse/package/1267.html Quote Link to comment https://forums.phpfreaks.com/topic/196197-reconstitute-the-image/#findComment-1030435 Share on other sites More sharing options...
RON_ron Posted March 23, 2010 Author Share Posted March 23, 2010 Thanks! I'll play around with it and get back! Quote Link to comment https://forums.phpfreaks.com/topic/196197-reconstitute-the-image/#findComment-1030436 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.