Thumbnails mit Ordnerauslesen !!!
lima-city → Forum → Programmiersprachen → PHP, MySQL & .htaccess
-
Hi,
ich hab dieses Thumbnails nur das was mir nicht ganz dran gef?llt ist, das es immer nur ein bild bearbeiten kann!
ist es m?gliche dieses teil so umzuschreiben, das es einen ganzen ordner mit Bilder auslesen kann und ausgibt?
wenn ja wie oder hat das schon mal einer ??
bitte helft mir weiter!!!!
FRESHfire
<?php function thumb_popup($file, $save, $width, $height, $prop = TRUE) { // Requires GD-Lib > 1.6 // Ist $prop=TRUE, so werden die Proportionen des Bildes // auch im Thumbnail eingehalten if(!function_exists("show_popup")) { function show_popup($original, $thumb) { $infos = @getimagesize($original); $w = $infos[0] + 40; $h = $infos[1] + 40; $infos_th = @getimagesize($thumb); $link = "<a href=\"javascript:void(0);\" onclick=\"window.open('".$original."', 'window".md5(microtime())."', 'toolbars=0, scrollbars=1, location=0, statusbars=0, menubars=0, resizable=1, width=".$w.", height=".$h.", left = 20, top = 20');\">"; $link .= "<img src=\"".$thumb."\" border=\"0\" ".$infos_th[3]."></a>\n"; return $link; } } if(!file_exists($save) || @filemtime($thumb)< @filemtime($file)) { @unlink($save); $infos = @getimagesize($file); if($prop) { // Proportionen erhalten $iWidth = $infos[0]; $iHeight = $infos[1]; $iRatioW = $width / $iWidth; $iRatioH = $height / $iHeight; if ($iRatioW < $iRatioH) { $iNewW = $iWidth * $iRatioW; $iNewH = $iHeight * $iRatioW; } else { $iNewW = $iWidth * $iRatioH; $iNewH = $iHeight * $iRatioH; } // end if } else { // Strecken und Stauchen auf Gr??e $iNewW = $width; $iNewH = $height; } if($infos[2] == 2) { // Bild ist vom Typ jpg $imgA = imagecreatefromjpeg($file); $imgB = imagecreate($iNewW,$iNewH); imagecopyresized($imgB, $imgA, 0, 0, 0, 0, $iNewW, $iNewH, $infos[0], $infos[1]); imagejpeg($imgB, $save); return show_popup($file, $save); } elseif($infos[2] == 3) { // Bild ist vom Typ png $imgA = imagecreatefrompng($file); $imgB = imagecreate($iNewW, $iNewH); imagecopyresized($imgB, $imgA, 0, 0, 0, 0, $iNewW, $iNewH, $infos[0], $infos[1]); imagepng($imgB, $save); return show_popup($file, $save); } else { return FALSE; } } else { return show_popup($file, $save); } } // Quelldatei $from = "./meinverzeichnis/an9-6.jpg"; // Ziel 1+2 $to1 = "./th/thumb_a.jpg"; $to2 = "./th/thumb_b.jpg"; // Funktionsaufruf mit Einbehaltung der Proportionen echo thumb_popup($from, $to1, 150, 150, TRUE); echo "<br /><br />"; // Funktionsaufruf ohne Einbehaltung der Proportionen echo thumb_popup($from, $to2, 150, 150, FALSE); ?>
-
Diskutiere mit und stelle Fragen: Jetzt kostenlos anmelden!
lima-city: Gratis werbefreier Webspace für deine eigene Homepage