gd lib und Schlagschatten
Christian W.
- php
Hallo,
ich will mit unten folgendem Spript einen Schlagschatten (drop-shadow) erstellen, doch leider wird die Hintergrund Farbe nicht transparent und der Schatten wird nicht grau. Vielleicht könnt Ihr mir ja weiterhelfen.
$imgData = getimagesize("$img");
$thumbWidth = 60;
$thumbHeight = $imgData[1]*($thumbWidth/$imgData[0]);
$thumbName = (substr($img, 0, strrpos($img, '.'))).'.thumb.gif';
$sdw = 3;
$imgFile = ImageCreateFromJPEG($img);
$thumbnail = ImageCreateTrueColor($thumbWidth+$sdw, $thumbHeight+$sdw);
$bg1 = ImageColorAllocate($thumbnail, 246, 3, 222);
ImageFill($thumbnail, 0, 0, $bg1);
$shadow = ImageCreateTrueColor($thumbWidth, $thumbHeight);
$bg2 = ImageColorAllocate($shadow, 66, 66, 66);
ImageFill($shadow, 0, 0, $bg2);
ImageCopyResampled($thumbnail, $shadow, $sdw, $sdw, 0, 0, $thumbWidth, $thumbHeight, $imgData[0], $imgData[1]);
ImageCopyResampled($thumbnail, $imgFile, 0, 0, 0, 0, $thumbWidth, $thumbHeight, $imgData[0], $imgData[1]);
ImageColorTransparent($thumbnail, $bg1);
ImageGIF($thumbnail, $thumbName);
ImageDestroy($imgFile);
ImageDestroy($thumbnail);
ImageDestroy($shadow);
Okay hat sich erledigt.
Habe ImageCreateTrueColor mit ImageCreate ersetzt und dann gings.