[PHP] Wasserzeichen einfügen

Dieses Thema im Forum "Webentwicklung" wurde erstellt von master2005, 31. Oktober 2011 .

  1. 31. Oktober 2011
    Wasserzeichen einfügen

    Hallo..

    Ich komme irgendwie nicht weiter.

    ich würder gerne hier

    $inputfile = $upload_dir."/".$_FILES['Filedata']['name'];
    $max_width=500 ;
    $max_height=500 ;
    $outputfile= $upload_dir."b_".$neuerbildname.".jpg";
    $quali=90 ;

    if (substr(strtolower($inputfile), -3) == 'jpeg' || substr(strtolower($inputfile), -3) == 'jpg')
    $srcimg = imagecreatefromjpeg($inputfile);
    elseif (substr(strtolower($inputfile), -3) == 'gif')
    $srcimg = imagecreatefromgif($inputfile);
    elseif (substr(strtolower($inputfile), -3) == 'png')
    $srcimg = imagecreatefrompng($inputfile);

    if (!$srcimg)
    return false;
    else {
    $img_width = imagesx($srcimg);
    $img_height = imagesy($srcimg);


    if ($img_width > $max_width && $img_height > $max_height) {
    if ($img_height > $img_width) {
    $img_height = ceil($img_height*($max_width/$img_width));
    $img_width = $max_width;
    }
    else {
    $img_width = ceil($img_width*($max_height/$img_height));
    $img_height = $max_height;
    }
    }
    $thumbimg = imagecreatetruecolor($img_width, $img_height);
    imagecopyresampled($thumbimg,
    $srcimg,0,0,0,0,$img_width,
    $img_height,
    imagesx ($srcimg),
    imagesy($srcimg));


    $cutted_w = 0;
    $cutted_h = 0;
    if ($img_width > $max_width)
    $cutted_w = ($img_width-$max_width);
    if ($img_height > $max_height)
    $cutted_h = ($img_height-$max_height);


    $fill_w = 0;
    $fill_h = 0;
    if ($img_width < $max_width)
    $fill_w = ($max_width-$img_width);
    if ($img_height < $max_height)
    $fill_h = ($max_height-$img_height);

    $dstimg = imagecreatetruecolor($max_width, $max_height);
    imagefill($dstimg, 0, 0, imagecolorallocate($dstimg, 255, 255, 255));

    imagecopyresampled($dstimg, $thumbimg,
    $fill_w/2,$fill_h/2,
    $cutted_w/2,$cutted_h/2,
    $img_width-$cutted_w, $img_height-$cutted_h,
    $img_width-$cutted_w, $img_height-$cutted_h);

    if (substr(strtolower($inputfile), -3) == 'jpeg' || substr(strtolower($inputfile), -3) == 'jpg') {
    if ($outputfile !== false)
    imagejpeg($dstimg, $outputfile, $quali);
    else
    imagejpeg($dstimg);
    }
    elseif (substr(strtolower($inputfile), -3) == 'gif') {
    if ($outputfile !== false)
    imagegif($dstimg, $outputfile);
    else
    imagegif($dstimg);
    }
    elseif (substr(strtolower($inputfile), -3) == 'png') {
    if ($outputfile !== false)
    imagepng($dstimg, $outputfile);
    else
    imagepng($dstimg);
    }
    imagedestroy ($srcimg);
    imagedestroy ($thumbimg);
    imagedestroy ($dstimg);
    }

    noch in das Bild bevor es gespeichert wird ein Wasserzeichen unten rechts ".jpg" einfügen.

    Kann man dabei eventuell einer Helfen ?

    mfg
     
  2. Video Script

    Videos zum Themenbereich

    * gefundene Videos auf YouTube, anhand der Überschrift.