SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Threaded View

  1. #1
    SitePoint Guru
    Join Date
    Aug 2004
    Location
    Earth
    Posts
    739
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    GD + Overlay watermark

    Hi,

    Im trying to watermark my images on upload.

    The images are uploading but not getting watermarked.

    Mutliple images are uploaded, then I am trying to watermark them, then continue to create thumbs and resize images.

    Here is the part of code for watermark:

    PHP Code:
        $filetype $photos_uploaded['type'][$counter];
        
    $extention $known_photo_types[$filetype];
        
    $filename $new_id.".".$extention;

        
    mysql_query("UPDATE gallery SET photo_name='".$filename."' WHERE photo_id='".$new_id."'" );

        
    copy($photos_uploaded['tmp_name'][$counter], $images_dir."/".$filename);  

        
    $margin 5;
        
    $watermark imagecreatefrompng('watermark.png');
        
    $w getimagesize('watermark.png');

        
    $function_suffix $gd_function_suffix[$filetype];
        
    $Create 'ImageCreateFrom' $function_suffix;
        
    $Save 'Image' $function_suffix;

        
    $image $Create($images_dir."/".$filename);
        
    $image_size getimagesize($images_dir."/".$filename);

        
    $dest_x $size[0] - $w[0] - $margin;
        
    $dest_y $size[1] - $w[1] - $margin;

        
    imagecopy($image$watermark$dest_x$dest_y00$w[0], $w[1]);
        
    imagedestroy($image);
        
    imagedestroy($watermark);
                             
        
    $size GetImageSize$images_dir."/".$filename );

        
    $Config_tbwidth_wide 85;
        
    $Config_tbheight_wide 85;

        
    $Config_tbwidth_tall 85;
        
    $Config_tbheight_tall 85
    Thanks
    Last edited by _matrix_; Jul 22, 2007 at 00:55.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •