![]() |
|
|
|
|
1
20th December 23:41
External User
Posts: 1
|
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 |
|
|
|
|
2
20th December 23:43
External User
Posts: 1
|
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. |
|
|
|
| Some other forums that might be of your interest : Php 5 forum, Apache forum, Iis forum, Functions forum, Classes forum, Librarys forum, Bugs forum, Postgres forum, Mysql forum, Paradox forum, Ms sql forum, Configurations forum, Php.ini forum, Problems forum, Scripting forum, Css forum, General forums, Off-topic talk, Links, Extra forums, Php |