ID:               35245
 Updated by:       [EMAIL PROTECTED]
 Reported By:      walkekev at gmail dot com
-Status:           Open
+Status:           Feedback
 Bug Type:         MySQL related
 Operating System: Linux
 PHP Version:      4.4.1
 New Comment:

Please provide a *SHORT* but complete reproduce script, that is max.
10-20 line long.
Thanks.


Previous Comments:
------------------------------------------------------------------------

[2005-11-16 19:57:20] walkekev at gmail dot com

the script is availbe to view here
http://phppa.lngdonline.com/view.php?file=admin.php
http://phppa.lngdonline.com/view.php?file=./code/obufthumb.php

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

[2005-11-16 19:24:15] [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.



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

[2005-11-16 19:23:29] walkekev at gmail dot com

Description:
------------
The script will not do my sql statement if the ob_start() is called
before my sql statement

Reproduce code:
---------------
<?php // first page of code
$name = basename($_FILES['userfile']['name']);
        $filename = $_FILES['userfile']['tmp_name'];
        $data = file_get_contents($filename);
        $filedata = mysql_real_escape_string($data);
        list($width, $height) = getimagesize($filename);
        $sql = "INSERT INTO `pictures` ( `id` , `name` , `height` , `width` ,
`type` , `data` ) VALUES ( '', '$name', '$height', '$width', 'a',
'$filedata')";
        mysql_query($sql);
        require('./code/obufthumb.php');
        require('./database/sql.php');
        $sql = "INSERT INTO `pictures` ( `id` , `name` , `height` , `width` ,
`type` , `data` ) VALUES ( '', '$name', '$newheight', '$newwidth', 'b',
'$filedata')";
        mysql_query($sql);
?>
<?php // this is obufthumb.php
if($height > $width){
        $newheight = '120';
        $newwidth = '120' / $height * $width;
        }
else{
        $newwidth = '120';
        $newheight = '120' / $width * $height;
        }
$thumb = imagecreatetruecolor($newwidth, $newheight);
$source = imagecreatefromjpeg($filename);
imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight,
$width, $height);
ob_start();
imagejpeg($thumb, NULL, 100);
$filedata = ob_get_contents();
ob_end_clean();
?>

Expected result:
----------------
is should insert 2 images into the database, one that is no more then
120px wide or tall.

Actual result:
--------------
it only inserts one into the database, the first one, with type a.

when i remove the ob_start() and ob_end_clean() it will work, both wil
be inserted, but all the code of the jpeg is inserted into my screen


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


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

Reply via email to