ID: 36801 Updated by: [EMAIL PROTECTED] Reported By: glavoie at mutehq dot net -Status: Open +Status: Bogus Bug Type: GD related Operating System: Debian Sarge GNU/Linux PHP Version: 5.1.2 New Comment:
Looks like you're using MPEG-JPEG codec and libgd detects your file as JPEG image. I'm not sure if anything can be done about it, but it's definitely not PHP problem. Previous Comments: ------------------------------------------------------------------------ [2006-03-20 21:44:11] glavoie at mutehq dot net I use this script to convert images to JPEG with resizing when needed. When a MPEG file is given to imagecreatefromstring(), $source doesn't return false and I get an images($source) of 1 and a imagesy($source) of ~7000. When creating the new resized image with imagecreatetruecolor, the ratio is huge and an image of about 2.5 GB is created in memory. <?php if ( isset( $_GET['width'] ) ) $width = $_GET['width']; else $width = 0; $source = imagecreatefromstring( file_get_contents('1.mpg') ); if ($source) { if ( $width ) { $ratio = $width / imagesx( $source ); $resized = imagecreatetruecolor( $width, $ratio * imagesy( $source ) ); imagecopyresampled( $resized, $source, 0, 0, 0, 0, $width, $ratio * imagesy( $source ), imagesx( $source ), imagesy( $source ) ); $source = $resized; } ob_start(); imagejpeg($source); $photo = ob_get_contents(); ob_end_clean(); header( 'Content-type: image/jpeg' ); echo $photo; } ?> ------------------------------------------------------------------------ [2006-03-20 19:13:58] [EMAIL PROTECTED] Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with <?php and ends with ?>, is max. 10-20 lines long and does not require any external resources such as databases, etc. If possible, make the script source available online and provide an URL to it here. Try to avoid embedding huge scripts into the report. ------------------------------------------------------------------------ [2006-03-20 19:08:30] glavoie at mutehq dot net Description: ------------ If I give the content of a MPEG file to imagecreatefromstring, it doesn't return an error. This is causing me an headach with HTTP graphic file upload since I must be sure that uploaded files are realli graphic ones for resizing. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=36801&edit=1