SitePoint Sponsor

User Tag List

Page 5 of 6 FirstFirst 123456 LastLast
Results 101 to 125 of 138
  1. #101
    SitePoint Member
    Join Date
    Dec 2007
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yeah not bad prog but i used VidLogo and it was more comfy i think and more simple.
    btw its not only my opinion.
    i did my work very fast without troubles:)
    i adcvic VL to all
    GLuck and Marry Xmas:))

  2. #102
    Raitus
    SitePoint Community Guest
    Something wrong... I got the image but without watermark. What coul'd be wrong?

  3. #103
    uweb
    SitePoint Community Guest
    Why the line
    $image = imagecreatetruecolor($watermark_width, $watermark_height);

  4. #104
    uweb
    SitePoint Community Guest
    Also, imagecopymerge() won't preserve transparency (a bug of this function maybe). Use imagecopy() if the watermark.png has an alpha channel that you'd like to preserve.

  5. #105
    yusof ashor
    SitePoint Community Guest
    hello
    I can not understand english good
    so how can I download the file and
    upload it to my images folder
    please,I want the file ready

  6. #106
    paqman
    SitePoint Community Guest
    Yes, like uweb said, if you want to use a png24 simply replace imagecopymerge($image, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height, 100); with imagecopy($image, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height);

  7. #107
    Mark
    SitePoint Community Guest
    I could not preserve the transparency when I was attaching a watermark and the reason was that when using imagecopy you should use the image height not the window height. eg. imagecopy($image, $watermark, $dest_x, $dest_y, 0, 0, $image_width, $image_height)

  8. #108
    Mark
    SitePoint Community Guest
    Whoops, when I said window height for my previous comment, I meant watermark height. So basically when using imagecopy to keep transparency I used the image width and height, instead of the watermark width and height as the last two parameters. I really don't understand why this works, as opposed to using the watermark dimensions, but it does, otherwise it would copy it with a black background.

  9. #109
    SitePoint Member Mashka's Avatar
    Join Date
    Aug 2007
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by kekelka View Post
    yeah not bad prog but i used VidLogo and it was more comfy i think and more simple.
    btw its not only my opinion.
    i did my work very fast without troubles
    i adcvic VL to all
    GLuck and Marry Xmas)
    he-h! I heard about VidLogo only good things!!!
    I would like to try it right now!!!
    Have a good day, guys!!!

  10. #110
    Jeff
    SitePoint Community Guest
    Great script

  11. #111
    SitePoint Member jellen's Avatar
    Join Date
    Jul 2008
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I usually use programm to resize my pictures,then upload the pictures to my host!Batch Watermark Creator is a good choice,That's the one I know how to use.visit the on-line places and search it;

  12. #112
    Prince Blessing Sunday
    SitePoint Community Guest
    Good one but the next time you put something like this up, don't fail to put up a sample. It helps. Thank a lot

  13. #113
    SitePoint Wizard
    Join Date
    Jun 2005
    Posts
    1,436
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What do others here use for auto watermarking images ?

  14. #114
    Gilles
    SitePoint Community Guest
    @ Jellen: the point of this tutorial is not to teach people how to use a software but how to watermark a picture using PHP. Your software can not watermark if a picture is uploaded to a site by a third party or the site owner. Here doesn't matter how the picture get there it will be watermarked

    @ Prince Blessing Sunday: A sample for a 13 lines code is pretty much useless, if one can not be bothered to copy paste the above and create 2 images to test it out then one should really considering quiting development lol

    @ Dez: this is a vague question, you have software and other development language, in PHP there isn't 100 ways of doing it.

    @ the author: well done, nice, easy and to the point :)

  15. #115
    Mark
    SitePoint Community Guest
    Works great. Thanks for the tutorial.

  16. #116
    SitePoint Wizard
    Join Date
    Jun 2005
    Posts
    1,436
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    @ Gilles : Not entirely vague - just wondering if the other members here use other coding ways in PHP for doing this.

  17. #117
    hope
    SitePoint Community Guest
    how to execute this in browser??

  18. #118
    Rampage
    SitePoint Community Guest
    <img src="yourscript.php?src=blabla.jpg"/>

  19. #119
    SitePoint Member
    Join Date
    Sep 2008
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by hellcat View Post
    This is howto tile your watermark...call your image in html like this

    <img src="watermark.php?file=image.jpg"></img>


    contents of watermark.php

    <?php
    // watermark.php
    // 4/29/2007 11:32:42 PM

    header('content-type: image/jpeg');

    $watermark = imagecreatefrompng('watermark.png');

    $watermark_width = imagesx($watermark);
    $watermark_height = imagesy($watermark);

    $alpha=15;

    $image = imagecreatetruecolor($watermark_width, $watermark_height);
    $image = imagecreatefromjpeg($_GET['file']);
    $size = getimagesize($_GET['file']);

    $dest_x = $size[0];
    $dest_y = $size[1];

    $c_dest_x = 0;
    $c_dest_y = 0;

    // loop/tile watermark until image full
    while ($dest_x > $c_dest_x && $dest_y >= $c_dest_y)
    { // insert wartermark

    imagecopymerge($image, $watermark, $c_dest_x, $c_dest_y, 0, 0, $watermark_width, $watermark_height, $alpha);

    // math for new watermark postition
    if ($c_dest_x < $dest_x)
    { $c_dest_x = $c_dest_x + $watermark_width; }

    if ($c_dest_x >= $dest_x && $c_dest_y <= $dest_y)
    { $c_dest_x = 0;
    $c_dest_y = $c_dest_y + $watermark_height;
    }
    }

    imagejpeg($image);
    imagedestroy($image);
    imagedestroy($watermark);

    ?>
    this is exactly what i need... except one little thing, actually two.
    frist of all THANK YOU SO MUCH for this code.

    i need my watermark to be aligned top, right and not tile- my png is going to be just SMALL 150x40px image and i wanted it to be bottom->right without tile, if you can helo i would appreciate alot, thanks!

  20. #120
    SitePoint Member Mashka's Avatar
    Join Date
    Aug 2007
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    VidLogo is good, that's enough for me...
    Have a good day, guys!!!

  21. #121
    SJSD
    SitePoint Community Guest
    Anyone got problems with some jpg-files? I get error message on some jpg-files: Warning: imagecopymerge(): supplied argument is not a valid Image resource in

  22. #122
    SitePoint Enthusiast
    Join Date
    Oct 2005
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up

    Found this great Online Watermark Tool. It gives you a ton of options to customize your watermark.

    Armin
    Online Games - Play Free Online Games
    Arcade Games - Tons of Arcade Games
    Watermark Tool - Protect your Photos

  23. #123
    SitePoint Guru
    Join Date
    Jun 2006
    Posts
    638
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This code is good for generating the image, but if you plan to use it in production, you need to add some caching to it.

    Either cache the image data to a file/database, and server it if it's already generated, or cache it in some proxy server or something (no code changes, but needs that server).

    Generating the water mark for every image on your site on the fly will be really slow when you have a bit of traffic or pages with allot of images (gallery style).

  24. #124
    NeoMorph
    SitePoint Community Guest
    Just got to say that I spent near enough 9 hours of looking around the net last night and trying many, MANY different tutorials but not one worked... until I downloaded yours that is. All I got was the white box with the little red x inside mocking me or error messages that didn't make a lot of sense to me.

    BUT YOURS WORKED FIRST TIME.

    I just decided to have one more go and found yours thank god... now I can sleeeeeep.

    Mr Ferguson you deserve an attaboy for putting together a tutorial that is simple, easy to understand and actually WORKS.

    THANK YOU.

    NeoMorph

  25. #125
    SitePoint Enthusiast
    Join Date
    May 2004
    Location
    Ontario, Canada
    Posts
    99
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Guys,

    Just wanted to thank all of you for the kind comments regarding this tutorial. It's very cool to see that it's still getting activity 4 years after it's post. I'll have to think of something else to write about, now
    Brock Ferguson
    Lead Developer, Caribou CMS
    A Subscription/Membership CMS and Ecommerce Platform - FREE Trial


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
  •