note 11401 modified in function.imagecreatefromjpeg by felipe

From: Date: Tue, 22 Jul 2008 18:54:02 +0000
Subject: note 11401 modified in function.imagecreatefromjpeg by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-142528@lists.php.net to get a copy of this message
In response to my own post: Maybe this is common knowledge but here is how I solved my problem. Hopefully this will help out seeing how I couldn't find any other articles on this topic with a solution. This seems to work pretty well. Displays in browser and QT Picture Viewer but for some reason Photoshop won't open it. Translation error. Since I'm just using it to cache the image for when the our content provider goes down no biggie there. <?php $si = fopen($imagePathURL, "r"); // open URL $serverImg = fread($si, 1000000); // read contents fclose($si); // close file ?> /* open file to save to (w+ creates if file does not exist || b opens binary safe [Win32]) Seemed to work fine with out the 'b' on Windows NT but just to be safe. */ <?php $si = fopen($saveImgTo, "w+b"); fwrite($si, $serverImg); // write contents to file fclose($si); // close file ?> Hope this helps somebody...long live PHP --was-- In response to my own post: Maybe this is common knowledge but here is how I solved my problem. Hopefully this will help out seeing how I couldn't find any other articles on this topic with a solution. This seems to work pretty well. Displays in browser and QT Picture Viewer but for some reason Photoshop won't open it. Translation error. Since I'm just using it to cache the image for when the our content provider goes down no biggie there. $si = fopen($imagePathURL, "r"); // open URL $serverImg = fread($si, 1000000); // read contents fclose($si); // close file /* open file to save to (w+ creates if file does not exist || b opens binary safe [Win32]) Seemed to work fine with out the 'b' on Windows NT but just to be safe. */ $si = fopen($saveImgTo, "w+b"); fwrite($si, $serverImg); // write contents to file fclose($si); // close file Hope this helps somebody...long live PHP http://php.net/manual/en/function.imagecreatefromjpeg.php

« previous php.notes (#142528) next »