Re: Error while saving attachments (jpegs)
| From: | Richard Lynch | Date: | Fri, 07 Sep 2001 04:51:02 +0000 |
| Subject: | Re: Error while saving attachments (jpegs) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-66329@lists.php.net to get a copy of this message | ||
Try opening the origianl and downloaded files in a text editor and see if
you can spot the differences...
--
WARNING richard@zend.com address is an endangered species -- Use
ceo@l-i-e.com
Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
----- Original Message -----
From: Daniel Reichenbach <daniel.reichenbach@pixum.com>
Newsgroups: php.general
To: Php-General <php-general@lists.php.net>
Sent: Wednesday, September 05, 2001 9:31 AM
Subject: Error while saving attachments (jpegs)
> Hy,
>
> i wrote a little cron job which fetches mails from a pop account and
> saves all contained jpeg attachments to disc.
>
> I use the following code:
> --- snap ---
> // determine attachment encoding
> $atty = imap_fetchbody($mbox, $i, $b);
>
> switch($att_ency) {
> case "base64":
> $decoded_string = imap_base64($atty);
> break;
>
> case "binary":
> $decoded_string = imap_binary($atty);
> break;
>
> case "other":
> $decoded_string = $atty;
> break;
> }
>
> // save it to disc
> echo $upload_folder.$att_name;
> $fp = fopen ($upload_folder.$att_name , "w+");
> fwrite ($fp, $decoded_string, $atty_size);
> fclose ($fp);
> --- snap ---
>
> After saving there is a difference in filesize and the image is
> unusable. Original image size is 758.204 bytes and after saving
> the attachment to disc its 759.885 bytes. What am i doing wrong
> here?
>
> Greetings from Germany,
> Daniel
>