Ich habe ein Problem. Habe ein Bilderupload Schnipsel der mir ein Bild auf den Server lädt... Wie kann man einen Text am Bild beim uploaden einfügen so wie hier:
http://www.bigcitybeats.de/data/pict.../36/325762.jpg
Code:
http://www.bigcitybeats.de/data/pict.../36/325762.jpg
Code:
PHP-Code:
// Upload
$path="$serverpfad/images/";
$config_width="600";
$config_height="600";
$resizequality="80";
$_upload=$path;
$_time=time();
$datstamp=date("dmy");
if($_FILES['file']['name']){
$_rand=@rand(0,99);
if ($_FILES['file']['name']){
$getimagesize[$i]=@getimagesize($_FILES['file']['tmp_name']);
if($getimagesize[$i]['mime']=="image/jpeg" || $getimagesize[$i]['mime']=="image/png"){
$nfname="$datstamp-" . $_time*$_rand;
$art=substr($_FILES['file']['name'],-3);
if($art=="peg"||$art=="PEG"){
$art="jpeg";
}
$pic_filename=$nfname.".".$art;
$newimage=$_upload.$pic_filename;
if(@move_uploaded_file($_FILES["file"]["tmp_name"], $newimage)){} else {
@copy($_FILES["file"]["tmp_name"], $newimage);
}
if($art=="jpg"||$art=="JPG"||$art=="jpeg"||$art=="JPEG"){
$im = imagecreatefromjpeg( $newimage );
}
elseif($art=="png"||$art=="PNG"){
$im = imagecreatefrompng( $newimage );
}elseif ($art=="gif"||$art=="GIF"){
$im = imagecreatefromgif($newimage);
}
$mw = $config_width; // max width
$mh = $config_height; // max height
$ow = imagesx( $im );
$oh = imagesy( $im );
if( $ow > $mw || $oh > $mh ){
if( $ow > $oh ){
$tnw = $mw;
$tnh = $tnw * $oh / $ow;
} else {
$tnh = $mh;
$tnw = $tnh * $ow / $oh;
}
} else {
$tnw = $ow;
$tnh = $oh;
}
$imtn = imagecreatetruecolor( $tnw, $tnh );
$originaltransparentcolor = imagecolortransparent( $im );
if(
$originaltransparentcolor >= 0 // -1 for opaque image
&& $originaltransparentcolor < imagecolorstotal( $im )
) {
$transparentcolor = imagecolorsforindex( $im, $originaltransparentcolor );
$newtransparentcolor = imagecolorallocate(
$imtn,
$transparentcolor['red'],
$transparentcolor['green'],
$transparentcolor['blue']
);
imagefill( $imtn, 0, 0, $newtransparentcolor );
imagecolortransparent( $imtn, $newtransparentcolor );
}
imagecopyresized( $imtn, $im, 0, 0, 0, 0, $tnw, $tnh, $ow, $oh );
if($art=="jpg"||$art=="JPG"||$art=="jpeg"||$art=="JPEG")
{
imagejpeg( $imtn, $newimage );
}
elseif($art="png"||$art=="PNG")
{
imagepng( $imtn, $newimage );
}elseif ($art=="gif"||$art=="GIF"){
imagegif($imtn,$newimage);
}
imagedestroy( $im );
imagedestroy( $imtn );
}}}
Kommentar