Image

Imagef1vlad wrote in Imagephp

Hey guys,

I have an issue with piping. Well not piping itself but how to fetch files attached to messages. Here's how it works:

1. all emails are piped into script that inserts it into MySQL.
2. user logs in to web interface and retrieves all email messages from MySQL.
3. issue: attached files needed to be specially treated to be able to open them, and this is where I have a problem.

Here's what this file looks in body of email message like when piped into database, when of course it should be Unicode right?


------=_Part_3365_6086914.1150826471733 Content-Type: multipart/alternative; boundary="----=_Part_3366_28854909.1150826471733" ------=_Part_3366_28854909.1150826471733 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline test ------=_Part_3366_28854909.1150826471733 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline test ------=_Part_3366_28854909.1150826471733-- ------=_Part_3365_6086914.1150826471733 Content-Type: image/gif; name=image.gif Content-Transfer-Encoding: base64 X-Attachment-Id: f_eookbtrr Content-Disposition: attachment; filename="image.gif" R0lGODlhFAAUANUAAAAAAP///7Wqq8O6u8C3uM/HyNLLzM/IybGlp7musLWqrNjS08C2uOLd3uDb 3N7Z2tjT1MO6vMzExuvn6OTg4eHd3tHKzO/s7fb09fTy8/Lw8fz7/N/b2+zp6evo6PXz8/Ty8vHv 7+7s7P38/Pz7+/v6+vr5+fj39/b19fTz8/Lx8f7+/v39/fz8/Pv7+/r6+vn5+f///wAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAADEALAAAAAAUABQAAAbXwEBg tdqYUCpRx9O5qFCmFmslJLKOIQ+F83BQPCHUa1plkU4qT2NhOVgWDY/qRCKvWC/UhbKQRAgDEhAU ImJ2IyYpHQ4WEQkCCREWDh0pJiNUKyMwIB4PBwwKCAIMBQ8eIDCYQ1cfi42PkQaUlqt3JXoUEH4M ERILhBhjmSwuaBMVbAcGEA0Tc3WZd1haDg8cX2GXVGUtRyoXHRNNGlAtRELdJicoKRkpKCcvUtzp rCMuLzD7LyQjZPbSWWEx4h+LKegCCiTCMKHChw4fSpxIsaLFixiFBAEAOw== ------=_Part_3365_6086914.1150826471733--


I am trying to figure out what I should do with this file at the time of taking it from database. Obviously GIF content isn't going to be shown if I use it as is.

Hope I explained clearly... Do you have any suggestions how to treat attached files saved in database like this?
Thanks,