Edit report at http://bugs.php.net/bug.php?id=51063&edit=1

 ID:          51063
 Updated by:  [email protected]
 Reported by: [email protected]
 Summary:     Add getimagesizefromstring
 Status:      Assigned
 Type:        Feature/Change Request
 Package:     Feature/Change Request
 PHP Version: 5.3.1
 Assigned To: pajoye

 New Comment:

Patch looks good except for one thing, that is the parameter parsing.
You should 

use something along the lines of:



char *file;

int file_len;

HashTable *ht;



if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMS_CC, "s|H", &file,
&file_len, 

&ht) == FAILURE)



The old (and deprecated) way of first doing a switch and use 

zend_get_parameters*() should be avoided.



Else good work on the patch ;)


Previous Comments:
------------------------------------------------------------------------
[2010-02-17 14:25:04] [email protected]

Will apply it shortly after review (probably this WE). However it looks
good already, thanks :)

------------------------------------------------------------------------
[2010-02-17 03:59:22] [email protected]

Here is a test for the new function:



http://www.brianfrance.com/software/php/getimagesizefromstring/001.phpt



and the required test.gif (php logo image):



http://static.php.net/www.php.net/images/php.gif

------------------------------------------------------------------------
[2010-02-16 21:54:26] [email protected]

Description:
------------
It would be nice to be able to pass in a string to getimagesize.



Here is a patch that takes the original getimagesize function and turns
it into php_getimagesize_from_stream.  Then getimagesize and a new
function getimagesizefromstring can use the function once a stream is
created.



http://www.brianfrance.com/software/php/getimagesizefromstring.diff





Reproduce code:
---------------
<?PHP

$img = 'test.gif';



var_dump(getimagesize($img));



$data = file_get_contents($img);



var_dump(getimagesizefromstring($data));

?>





------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=51063&edit=1

Reply via email to