note 70174 added to ref.image
| From: | trucex | Date: | Thu, 05 Oct 2006 19:25:42 +0000 |
| Subject: | note 70174 added to ref.image | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-118096@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 216.194.113.175
Probable Submitter: 69.252.131.134
----
Manual Page -- http://www.php.net/manual/en/ref.image.php
Edit -- https://master.php.net/note/edit/70174
Del: integrated -- https://master.php.net/note/delete/70174/integrated
Del: useless -- https://master.php.net/note/delete/70174/useless
Del: bad code -- https://master.php.net/note/delete/70174/bad+code
Del: spam -- https://master.php.net/note/delete/70174/spam
Del: non-english -- https://master.php.net/note/delete/70174/non-english
Del: in docs -- https://master.php.net/note/delete/70174/in+docs
Del: other reasons-- https://master.php.net/note/delete/70174
Reject -- https://master.php.net/note/reject/70174
Search -- https://master.php.net/manage/user-notes.php