php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13617 wrong saved pictures
Submitted: 2001-10-09 13:36 UTC Modified: 2001-12-19 08:46 UTC
From: Lorenz dot gross at gmx dot de Assigned:
Status: Closed Package: GD related
PHP Version: 4.0.6 OS: Windows 2000 Professional SP 2
Private report: No CVE-ID: None
 [2001-10-09 13:36 UTC] Lorenz dot gross at gmx dot de
The GB-Libary has problem to save files (JPEG), i open any and make it small und some pictures are black or driverent colors then the orginal pictures, this script has no problems with 4.0.4PL1 only in 4.0.6

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-10-09 13:55 UTC] sander@php.net
Can you post a sample script?

This might be a bug in GD 2.0 (just guessing). It's still a beta. You can try using the php_gd.dll from the PHP-4.0.5 package (see http://www.php.net/downloads.php) with PHP-4.0.6.
 [2001-10-10 09:54 UTC] Lorenz dot gross at gmx dot de
<?
#complete code

$Max_size = 100;
$unterverzeichnis = "tn";
$anz_pic = 0; 

$jn = file_exists("$unterverzeichnis/.");
	if ($jn != TRUE) {
		mkdir("$unterverzeichnis", 0700);
		echo "nicht vorhandender Ordner wurde erstellt.<br>";
	}

if ($bild == "") {
$verzeichnis = dir(""); 
while($imagefile = $verzeichnis->read()) { 
  if(strstr($imagefile,".jpg"))
		{
		$src_img = imagecreatefromjpeg($imagefile); 
		
		if (imagesx($src_img) > imagesy($src_img)) {
		$new_w = 100;

$new_h = imagesy($src_img) / imagesx($src_img) * 100;

		} else {
		$new_h = 100;

$new_w = imagesx($src_img) / imagesy($src_img) * 100;
		}

		$dst_img = imagecreate($new_w,$new_h); 

		imagecopyresized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,imagesx($src_img),imagesy($src_img)); 
		imagejpeg($dst_img, "$unterverzeichnis/$imagefile"); 
		echo "<img src=$unterverzeichnis/$imagefile><br>\n";
		$anz_pic++;
		echo "Bild <b>$imagefile</b> umgewandelt. (bereits $anz_pic St?ck)<br><br>\n"; 
		}
} 
$verzeichnis->close();

echo "<b>Verzeichnis komplett umgewandelt</b>";
} else {
		$imagefile = $bild;
  		if(strstr($imagefile,".jpg"))
		{
		$src_img = imagecreatefromjpeg($imagefile); 
		
		if (imagesx($src_img) > imagesy($src_img)) {
		$new_w = 100;

$new_h = imagesy($src_img) / imagesx($src_img) * 100;

		} else {
		$new_h = 100;

$new_w = imagesx($src_img) / imagesy($src_img) * 100;
		}

		$dst_img = imagecreate($new_w,$new_h); 

		imagecopyresized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,imagesx($src_img),imagesy($src_img)); 
		imagejpeg($dst_img, "$unterverzeichnis/$imagefile"); 
		echo "<img src=$unterverzeichnis/$imagefile><br>\n";
		echo "Bild <b>$imagefile</b> umgewandelt.<br><br>\n"; 
		} else {
		echo "kein g?ltiges bild";
		}

}
?>
 [2001-11-28 08:41 UTC] sander@php.net
Have you tried the php_gd.dll from 4.0.5? If not, please do that.

And if that doesn't work, please make a SHORT sample script which reproduces your problem and post it here.
 [2001-12-19 08:46 UTC] sander@php.net
No feedback. Closing.
 [2002-05-28 19:38 UTC] webmaster at secretsound dot nl
you should use imagecreatetruecolor() at line...

$dst_img = imagecreate($new_w,$new_h);
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 23:01:28 2024 UTC