<?php include("$inc/inc/init.php"); $sql = $db->Query("SELECT galwidth,galheight,nofactor,thumbcomp FROM " . PREFIX . "_settings"); $row = $sql->fetchrow(); $pref['thumbw'] = !$row->galwidth ? 120 : $row->galwidth; $pref['thumbh'] = !$row->galheight ? 90 : $row->galheight ; $pref['nofactor'] = $row->nofactor; $pref['thumbcomp'] = !$row->thumbcomp ? 90 : $row->thumbcomp; switch($_REQUEST['smode']){ case 1 : $thumb_w = $pref['thumbw'] / 2.2; $thumb_h = $pref['thumbh'] / 2.2; break; case 2 : $thumb_w = $pref['thumbw'] / 1.8; $thumb_h = $pref['thumbh'] / 1.8; break; default: $thumb_w = $pref['thumbw']; $thumb_h = $pref['thumbh']; break; } $w = $thumb_w; $h = $thumb_h; if ($_REQUEST['type'] == "inline") { //header ("Content-type: image/jpeg"); $end = ".jpg"; $q = BASEDIR . "/uploads/inlineshots/" . $_REQUEST['img_id']. ""; $quelle = imagecreatefromjpeg(BASEDIR . "/uploads/inlineshots/" . $_REQUEST['img_id'] . ""); //header ("Content-type: image/jpeg"); } } else { $sql = $db->Query("SELECT path FROM " . $dbprefix . "_gallery_items WHERE id=$_REQUEST[img_id] "); $row = $sql->fetchrow(); if (!$row) $row->path = "nopic.jpg"; $q = BASEDIR . "/uploads/galerie/" . $row->path . ""; if($end == '.jpg' || $end == 'jpeg'); //header ("Content-type: image/jpeg"); elseif($end == '.png'); //header ("Content-type: image/png"); elseif($end == '.gif'); //header ("Content-type: image/gif"); } switch($end){ case '.jpg': case 'jpeg': $q = BASEDIR . "/uploads/galerie/" . $row->path . ""; $quelle = imagecreatefromjpeg($q); break; case '.png': $q = BASEDIR . "/uploads/galerie/" . $row->path . ""; $quelle = @imagecreatefrompng($q); break; default: $quelle = $q; break; } } $sz = $thumb_w; $sz2 = $thumb_h; $im_width = imageSX($quelle); $im_height = imageSY($quelle); if ($pref['nofactor'] != 1) { $factor = $sz / $im_width; $w = $sz; $h = $im_height * $factor; } if (gdversion() >= 2) { $ziel = imagecreatetruecolor($w, $h); $ziel_bg = imagecolorallocate($ziel,255,255,255); imagefill($ziel , 0, 0, $ziel_bg); } else { $ziel = imagecreate($w, $h); } @imagecopyresampled($ziel, $quelle, 0, 0, 0, 0, $w, $h, imagesx($quelle), imagesy($quelle)); switch($end){ case '.jpg': case 'jpeg': $bild = @imagejpeg($ziel, "", $pref['thumbcomp']); break; case '.png': $bild = @imagepng($ziel, "", $pref['thumbcomp']); break; default: $bild = $quelle; break; } ?>
Z nieokreślonych przyczyn wygenerowany obrazek nie jest normalnie widoczny.
Gdy nie dam:
<?php ?>
Pojawią się znane każdmu krzaczki.
Ale nawet z gdy dodam typ obrazek nie pokazuje się poprawnie. Przykład tutaj. Na ekrenie pokazuje się url, zaś dopiero w kodzie strony są krzaczki.
Zawrówno bez nagłówka jak i z nim po zapisanu "strony" na dysku z właściwym rozszerzeniem obrazek normalnie działa. Co robię źle?