lolox
Grünschnabel
Hi,
ich weis das danach bestimmt schon tausendemale gefragt wurde, und gesucht habe ich auch schon aba in meinem script wird einfach kein text in das bild geschrieben, könnte mal jemand drüberschauen und evtl nen anstoß geben ?
ich übergebe meiner funktion folgenden daten
hier die funktion, die thumbnails werden wunderbar erstellt, nur leider ohne text :/
freue mich über jede hilfe
ich weis das danach bestimmt schon tausendemale gefragt wurde, und gesucht habe ich auch schon aba in meinem script wird einfach kein text in das bild geschrieben, könnte mal jemand drüberschauen und evtl nen anstoß geben ?
ich übergebe meiner funktion folgenden daten
PHP:
createthumb($path.$new_bild,$tpath.$new_thumb,$tsize,$tsize);
hier die funktion, die thumbnails werden wunderbar erstellt, nur leider ohne text :/
PHP:
//create thumbnails
function createthumb($name,$filename,$new_w,$new_h){
$system=explode('.',$name);
if (preg_match('/jpg|jpeg|JPG/',$system[1])){
$src_img=imagecreatefromjpeg($name);
}
if (preg_match('/png|PNG/',$system[1])){
$src_img=imagecreatefrompng($name);
}
if (preg_match('/bmp|BMP/',$system[1])){
$src_img=imagecreatefrombmp($name);
}
if (preg_match('/gif|GIF/',$system[1])){
$src_img=imagecreatefromgif($name);
}
$old_x=imageSX($src_img);
$old_y=imageSY($src_img);
if ($old_x > $old_y) {
$thumb_w=$new_w;
$thumb_h=$old_y*($new_h/$old_x);
}
if ($old_x < $old_y) {
$thumb_w=$old_x*($new_w/$old_y);
$thumb_h=$new_h;
}
if ($old_x == $old_y) {
$thumb_w=$new_w;
$thumb_h=$new_h;
}
$dst_img=ImageCreateTrueColor($thumb_w,$thumb_h);
$picinfo = getimagesize($name);
$schwarz = imagecolorallocate($dst_img, 0, 0, 0);
$weiss = Imagecolorallocate($dst_img, 255, 255, 255);
imagefilledrectangle($src_img, $picinfo[0], $picinfo[1], 0 , $picinfo[1]-60, $schwarz);
$text = 'Testing...';
// Replace path by your own font path
$font = 'arialf';
// Add the text
imagettftext($src_img, 30, 0, 10, $picinfo[1]-15, $weiss, $font, $text);
imagecopyresampled($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y);
if (preg_match("/png/",$system[1]))
{
imagepng($dst_img,$filename);
}
if (preg_match("/gif/",$system[1]))
{
imagegif($dst_img,$filename);
}
if (preg_match("/bmp/",$system[1]))
{
imagebmp($dst_img,$filename);
}
else {
imagejpeg($dst_img,$filename);
}
imagedestroy($dst_img);
imagedestroy($src_img);
}
freue mich über jede hilfe
Zuletzt bearbeitet: