Ich kannte Sie auch nicht, hab das Modul von diesem Beitrag genommen und erst jetzt gesehen, dass es sich um dieselbe Artikelliste handelt...
Das Problem mit der vorlage.jpg konnte ich mal lösen, jetzt wird das Bild wirklich in der Grösse verkleinert wie auch die vorlage ist. Musste die Zwei zeilen Auskommentieren
$to_x = round($maxdim-$to_w)/2;
$to_x = round($maxdim-$to_w)/2;
Nur leider hat das nichts gebracht, der Fehler muss irgendwo hier drin stecken:
Code: Alles auswählen
/******************* begin thumbnails **********************************/
if($print_thumbnail !="0" && $print_thumbnail !=""){
// select and resolve image path
$imagesql="select value from ".$cfg["tab"]["content"]." where idartlang='$value' and idtype='4' and typeid='CMS_VALUE[11]'";
$db2->query($imagesql);
$db2->next_record();
$image_id= $db2->f("value");
// get image name and path
$imagesql="select * from ".$cfg["tab"]["upl"]." where idupl='$image_id'";
$db2->query($imagesql);
$db2->next_record();
$webdir='upload/';
$thumbdir='CMS_VALUE[9]';
$filedir=$frontendpath;
$imagelocation=$filedir.$webdir.$db2->f('dirname').$db2->f('filename');
$thumblocation=$filedir.$webdir.$thumbdir.$db2->f('filename');
if (!file_exists($thumblocation)){
// create thunbnail
$fileinformation=getimagesize($imagelocation);
$imagewidth = $fileinformation[0];
$imageheight = $fileinformation[1];
$imagetype=$db2->f('filetype');
$imageattributes = $fileinformation[3];
//$newfile= $last_id."-image.".$imagetype;
$target=$thumblocation;
if ( !(copy($imagelocation,$target)))
{
echo "Could not copy file to destintaion., Command returned Error Message. Please check your log files. ".$imagelocation." ".$target;
die;
}
//create thumbnails 80xrelational height; neu $thumbnail_width x proportionale Höhe
// Determine what filetype and set pointer to source image
$original_image=ImageCreateFromJPEG($target);
if (!$original_image){
echo 'Error getting image from '.$target.'.';
}
$palette_image =$filedir.$webdir.$thumbdir.'vorlage.jpg';
$thumbsize = getImageSize($palette_image);
$maxdim = $thumbsize[0];
$draw_from = $imagelocation;
$dim = GetImageSize($draw_from);
if($dim[0]>$dim[1])
{
$to_w = $maxdim;
$to_h = round($dim[1]*($maxdim/$dim[0]));
$to_x = 0;
//$to_y = round($maxdim-$to_h)/2;
}
else
{
$to_h = $maxdim;
$to_w = round($dim[0]*($maxdim/$dim[1]));
$to_y = 0;
//$to_x = round($maxdim-$to_w)/2;
}
if($dim[2]==1) {$from = ImageCreateFromGIF($draw_from);}
elseif($dim[2]==2) {$from = ImageCreateFromJPEG($draw_from);}
elseif($dim[2]==3) {$from = ImageCreateFromPNG($draw_from);}
$thumb = ImageCreateFromJPEG($palette_image);
// $set_bg_colour = ImageColorAllocate($thumb,255,0,0);
// $fill_bg_colour = ImageFill($thumb,0,0,$set_bg_colour);
imagecopyresampled($thumb, $from, $to_x, $to_y, 0,
0, $to_w, $to_h, $dim[0], $dim[1]);
//echo $target;
// set image width and height of thunbnail and put pointer for filesytsem
$thumbfile= $db2->f('filename');
$target_thumb=$thumblocation;
$t_width=$thumbnail_width;
// calculating height to maintain ratio
$t_height=($thumbnail_width/$imagewidth)*$imageheight;
// remove digits to get solid number
list ($t_height,$notimportand)=explode('.',$t_height);
// create blank image
$thumb_image=imagecreatetruecolor($t_width,$t_height);
// $thumb_image=imagecreate($t_width,$t_height);
// $thumb_image=ImageCreateFromJPEG($palette_image);
// resize image based on height and width
imagecopyresampled($thumb_image,$original_image,0,0,0,0,$t_width,$t_height,$imagewidth,$imageheight);
// store image on file system
// requires different functionf for either gif or jpeg
imagejpeg($thumb,$target_thumb);
imagedestroy($thumb);
imagedestroy($original_image);
}
$image=$webdir.$thumbdir.$db2->f('filename');
//wenn Artikel kein Bild hat
if (!$db2->f('filename')){
$image=$webdir.$thumbdir.'vorlage.jpg';
}
//Ende
$imagetag="<img src=\" $image \" border=0>";
} // ende wenn keine thumbs gewünscht
/**************** Ende Thumbnails ***********************/
imagecopyresampled habe ich auch schon in imagecopyresized geändert, bringt auch nichts.... *japs