From:             bcarlowise at yahoo dot com
Operating system: SuSE Enterprise Linux 10.0
PHP version:      5.1.4
PHP Bug Type:     GD related
Bug description:  Imagecreatefromjpeg / Imagejpeg not functioning properly

Description:
------------
Scenario:

  I have a MySQL database with a table that I store photos in. I am trying
to extract the photo from the database and display the photo in a web page.
I can get the code to display the raw stream if I "echo" the variable but
it will not display the actual photo when I call the imagecreatefromjpeg
and imagejpeg functions and pass the arguments according to the
documentation.

SuSE Linux Enterprise 10.0
Apache 2.2.0-21.2
PHP 5.1.2-29 (php5-gd module installed)
GD 2.0.32-23


Reproduce code:
---------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"
/>
<title>Image Display Test</title>
</head>

<body>


<?php

$db=mysql_connect("<server>", "<username>", "<password>") or
die(mysql_error());
mysql_select_db("<schema>") or die(mysql_error());

$sql = "Select * from <table> where id= 1";
$result = mysql_query($sql);

//if (!$result) {
//    die('Invalid query: ' . mysql_error());
//}
//Else

$myrow = mysql_fetch_array($result);

$id = $myrow[0];
$gallery = $myrow[1];
$image = $myrow[2];
$hits = $myrow[3];

echo "id=$id", ", gallery=$gallery", ", hits=$hits";

if ($image!=false) {

  echo $image;   //**this will produce the raw stream**

  $source = imagecreatefromjpeg($image);
  imagejpeg($source, $source, 75);  //**this displays nothing but should
display the image??**

  exit;
}

Else
  echo "No valid image found.";

?>

<p>&nbsp;

</p>
</body>
</html>

Expected result:
----------------
To have the photo displayed in the browser.

Actual result:
--------------
the raw stream is displayed from the echo statement but nothing is
displayed from the imagejpeg function.

-- 
Edit bug report at http://bugs.php.net/?id=38108&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=38108&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=38108&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=38108&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=38108&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=38108&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=38108&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=38108&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=38108&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=38108&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=38108&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=38108&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=38108&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=38108&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=38108&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=38108&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=38108&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=38108&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=38108&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=38108&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=38108&r=mysqlcfg

Reply via email to