note 70174 deleted from ref.image by nlopess
| From: | nlopess@php.net | Date: | Thu, 05 Oct 2006 19:28:57 +0000 |
| Subject: | note 70174 deleted from ref.image by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-118097@lists.php.net to get a copy of this message | ||
Note Submitter: trucex [um, at] gmail [um, dot] com
----
If you want to take advantage of all the types of images the GD library is capable of opening, but
you don't want to go through checking what type the image is and handling it with the proper
function, just use imagecreatefromstring(). The GD library will automatically determine the type of
the image via MIME type and process it accordingly. I'd imagine this is faster since it's
running off of C code instead of PHP, though the performance gains are pretty petty.
As a ridiculously simple example...
<?php
$data = filegetcontents($url);
$im = imagecreatefromstring($data);
?>
I strongly recommend you use libCurl or sockets for retrieving remote files in public scripts/live
code due to performance. http://monitor.trucex.com/curltest.php for more
proof.