Mombu the Php Forum

Go Back   Mombu the Php Forum > Php > note 70174 added to ref.image
User Name
Password
REGISTER NOW! Mark Forums Read




Reply Bookmark and Share
1 20th December 23:41
External User
 
Posts: 1
Default note 70174 added to ref.image



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
  Reply With Quote


 


2 20th December 23:43
nlopess
External User
 
Posts: 1
Default note 70174 deleted from ref.image by nlopess



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.
  Reply With Quote


 


Reply


Thread Tools
Display Modes


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


Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666