|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[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 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 08:00:02 2025 UTC |
<? #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"; } } ?>