示例#1
0
	}
        $proimagename=$image[0]['photo'];
        $file=$proimagename;
        $ext = pathinfo($file, PATHINFO_EXTENSION);
        
$path   = '../upload';
$filename = $path ."/".$file;
$image_path = "../images/wlogo.png";
$font_path = "Jambetica.ttf";
$font_size = 20;       // in pixcels
//$water_mark_text_1 = "9";
$water_mark_text_2 = "Find My Jodi";
if(strlen($file))
{
    if($ext=="jpg" || $ext=="JPG" || $ext==="jpeg"){
    $data= watermark_image($filename, $filename);
    }
}

?>
<?php
function watermark_image($oldimage_name, $new_image_name){
    global $image_path;
    list($owidth,$oheight) = getimagesize($oldimage_name);
    $width =$owidth;
    $height = $oheight;	
    $im = imagecreatetruecolor($width, $height);
    $img_src = imagecreatefromjpeg($oldimage_name);
    imagecopyresampled($im, $img_src, 0, 0, 0, 0, $width, $height, $owidth, $oheight);
    $watermark = imagecreatefrompng($image_path);
    list($w_width, $w_height) = getimagesize($image_path);        
示例#2
0
             ####################
             $image = new JImage($uploadPath);
             $properties = JImage::getImageFileProperties($uploadPath);
             $resizedImage = $image->resize('250', '250', true);
             $mime = $properties->mime;
             if ($mime == 'image/jpeg') {
                 $type = IMAGETYPE_JPEG;
             } elseif ($mime = 'image/png') {
                 $type = IMAGETYPE_PNG;
             } elseif ($mime = 'image/gif') {
                 $type = IMAGETYPE_GIF;
             }
             $resizedImage->toFile($uploadPath, $type);
             //create image .....
             //echo 'creem imaginea<br />';
             watermark_image($uploadPath, $uploadPath2, $mime);
             ####################
             ######adaugare in baza de date
             $upd_poza = ", `poza` = '" . $file_name . "'";
             //verificam daca avem poza
             $query = "SELECT `poza` FROM #__sa_profiles WHERE `uid` = '" . $uid . "'";
             $db->setQuery($query);
             $act_pic = $db->loadResult();
             if ($act_pic != '') {
                 //stergem avatarul existent
                 $deletePath = $base_path . $uid . DS . $act_pic;
                 JFile::delete($deletePath);
             }
         }
     }
 }