|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-11-16 19:24 UTC] tony2001@php.net
[2005-11-16 19:57 UTC] walkekev at gmail dot com
[2005-11-16 20:04 UTC] tony2001@php.net
[2005-11-24 01:00 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 10:00:01 2025 UTC |
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