SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: saving images

  1. #1
    boiler up blackdog's Avatar
    Join Date
    Jul 2002
    Location
    Purdue
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    saving images

    I want to automatically add my logo to images on my site. Right now I have some code that does it on the fly, so every time the page is viewed, it re-makes the image with logo. How can I modify this code so that it will add the logo once when I upload the file and then save it to save server load?
    Thanks

    here's what i have now:
    PHP Code:
    <?php  
    header
    ('content-type: image/jpeg');  
    $watermark imagecreatefromgif("images/logo.gif");
    $image1="articlepics/$id.jpg";
    $watermark_width imagesx($watermark);  
    $watermark_height imagesy($watermark);  
    $image imagecreatetruecolor($watermark_width$watermark_height);  
    $image imagecreatefromjpeg($image1);  
    $size getimagesize($image1);  
    $dest_x $size[0] - $watermark_width 5;  
    $dest_y $size[1] - $watermark_height 5;  
    imagecopymerge($image$watermark$dest_x$dest_y00$watermark_width$watermark_height100);  
    imagejpeg($image);  
    imagedestroy($image);  
    imagedestroy($watermark);  
    ?>

  2. #2
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,807
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    Change the imagejpeg($image); line to something like
    PHP Code:
    # bool imagejpeg ( resource $image [, string $filename [, int $quality]] )

    imagejpeg($image'filename_and_location/myfile.jpg'99); 
    That should save the image to your server into the location specified with a quality of 99&#37;

    REF: http://uk3.php.net/imagejpeg
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  3. #3
    boiler up blackdog's Avatar
    Join Date
    Jul 2002
    Location
    Purdue
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks spike!

  4. #4
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,807
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    No problem
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....


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
  •