ID: 32323
Updated by: [EMAIL PROTECTED]
Reported By: bavaglino at west dot de
-Status: Open
+Status: Assigned
-Bug Type: *Graphics related
+Bug Type: GD related
Operating System: Linux infong 2.4 #1
PHP Version: 4.3.10
Assigned To: pajoye
Previous Comments:
------------------------------------------------------------------------
[2005-03-16 13:58:30] bavaglino at west dot de
ok here we go.
i made a few test with different sizes of pictures.
above 2900 x 1933 pixel the thumbnail is only black.
i use this code for upload the picture:
--------------------------------------------------
###links zum Uploadverzeichnis###
$bildlink = "thumbs" ;
$dateiname = $_FILES['datei']['name'] ;
$dateitype = $_FILES['datei']['type'] ;
$dateisize = $_FILES['datei']['size'] ;
if (empty($dateiname)) {$fehlermeldung = ''.$TEXT['FILENAME'].'' ; }
elseif ( $dateisize > '5240000') {$fehlermeldung =
''.$TEXT['FILESIZE'].'' ; }
elseif ( strlen( $dateiname ) > '25')
{
$dateinamengroesse = strlen($dateiname) - 25 ;
$fehlermeldung = ''.$TEXT['FILELAENGE'].'' ;
}
elseif ( $dateitype == 'image/jpeg' || $dateitype == 'image/pjpeg' )
{
## umwandeln von umlauten ##
$dateiname1 = strtr("$dateiname", " ����", "_aous") ;
## umwandeln in kleinbuchstaben ##
$dateiname2 = strtolower("$dateiname1") ;
$bildteil = split("[.]",$dateiname2) ;
$dateivorhanden =
file_exists($bildlink.'/'.$bildteil[0].'_norm.'.$bildteil[1]) ;
if ($dateivorhanden) {$fehlermeldung = ''.$TEXT['FILEEXIST'].'' ;}
else {
## originalbild uploaden ##
move_uploaded_file( $datei , $bildlink.'/'.$dateiname2 ) ;
## wie gro� ist das originalbild ##
$gross = getimagesize( $bildlink.'/'.$dateiname2 ) ;
$breite = $gross[0] ;
$hoehe = $gross[1] ;
$typ = $gross[2] ;
$hoehe_norm = $hoehe * 200 / $breite ;
$image_norm = imagecreatetruecolor( 200 , $hoehe_norm ) ;
## neuen namen f�rs thumbnail vergeben ##
$bild_s = split("[.]",$dateiname2);
$dateiname2_norm = $bild_s[0].'_norm.'.$bild_s[1] ;
## thumbnail erstellen ##
$image_norm = imagecreatetruecolor(200, $hoehe_norm);
$image = imagecreatefromjpeg( $bildlink.'/'.$dateiname2 ) ;
imagecopyresampled($image_norm, $image, 0,0,
0,0,200,$hoehe_norm,$breite,$hoehe);
imagejpeg($image_norm, $bildlink.'/'.$dateiname2_norm , 100 );
$fehlermeldung = ''.$TEXT['FILEDONE'].'' ;
}
}
else {$fehlermeldung = ''.$TEXT['FILEDONEERROR'].'';
}
}
-------------------------------------------------
please download example pictures here:
original picture with 3072 pixel:
http://www.klixx.com/picsearch/thumbs/testbild_3072.jpg
example picture with 2600 pixel:
http://www.klixx.com/picsearch/thumbs/testbild_2600.jpg
example picture with 2900 pixel:
http://www.klixx.com/picsearch/thumbs/testbild_2900.jpg
thanks for help
------------------------------------------------------------------------
[2005-03-15 21:51:41] [EMAIL PROTECTED]
Please provide the original image. Use a simple script without dynamic
values, something like the sample available at
http://de3.php.net/imagecopyresampled
--Pierre
------------------------------------------------------------------------
[2005-03-15 20:23:14] bavaglino at west dot de
i changed $image_norm with $image now it's correct for this post, but
still larger pictures only thumbnails in black.
imagecopyresampled($image_norm, $image, 0,0,
0,0,200,$hoehe_norm,$breite,$hoehe);
------------------------------------------------------------------------
[2005-03-15 19:57:49] bavaglino at west dot de
Description:
------------
I have a picture upload which upload the original file and a thumbnail
pic. it works fine, but when i use a picture for example with 180DPI
and 3000 x 2000 Pixel, the created thumbnail is only black.
with a smaller resolution it works fine.
Reproduce code:
---------------
$image = imagecreatefromjpeg( $bildlink.'/'.$dateiname2 ) ;
imagecopyresampled($image, $image_norm, 0,0,
0,0,200,$hoehe_norm,$breite,$hoehe);
imagejpeg($image_norm, $bildlink.'/'.$dateiname2_norm , 100 );
Expected result:
----------------
i want to see the picture in a smaller version but not a black
picture.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=32323&edit=1