Entry
Anybody know how or if ImageCreateFrom__() function works with URLs? Error: Can't read image when using http://
Feb 20th, 2001 13:17
Mike Boucher, http://www.php.net/manual
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 our content provider's server goes down, not being able to
edit the images in PS is no biggie there. (This might even be due
to the fact that the image is being created on a Windows NT
machine and I am trying to open it on a MAC computer. Might have
to check into that further.)
And now on with the code. Pretty simple and straight forward.
<?
$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 in the future.
mb
ampmedia.net