SitePoint Sponsor

User Tag List

Page 4 of 6 FirstFirst 123456 LastLast
Results 76 to 100 of 138
  1. #76
    Anonymous
    SitePoint Community Guest
    What's the point in using 100% for the last parameter of imagecopymerge() ?
    Quote PHP manual: "when 100 this function behaves identically to imagecopy()".

    And I think you should use a random value for this(range 40-60%) to make it impossible for other scripts to substract the watermark pixel values.

    But dispite this, good tutorial !

  2. #77
    SitePoint Member
    Join Date
    Aug 2003
    Location
    London
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Wow, this has been a great tutorial and a great thread as well, thanks guys! After reading the article originally, I just couldn't work out how to call it, well thats now sorted, Im going to attempt to do the .htaccess coding to secure my images now.
    Looking for Computer products and services in London?
    Look no further than IT Computer Solutions UK

  3. #78
    Peter
    SitePoint Community Guest
    That is simple and cool, thanks!

  4. #79
    SitePoint Member
    Join Date
    Aug 2006
    Posts
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks for it, i was thinking to watermark my project's images (not ready yet) and u gave me a great idea.

  5. #80
    SitePoint Member
    Join Date
    Aug 2006
    Posts
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks for it, i was thinking to watermark my project's images (not ready yet) and u gave me a great idea.

  6. #81
    anue0159
    SitePoint Community Guest
    Can PHP do the invisible watermark

  7. #82
    Todd
    SitePoint Community Guest
    Is there any way to do this to Videos using PHP?

  8. #83
    Colin
    SitePoint Community Guest
    You could call an instance of vlc using the exec function to watermark your videos.

  9. #84
    Paddy
    SitePoint Community Guest
    I had to add this after the second line to make it work with png-24 and alpha channel:

    imageAlphaBlending($watermark, false);
    imageSaveAlpha($watermark, true);

  10. #85
    SitePoint Member
    Join Date
    Feb 2007
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    when i try and use this watermark script the image does not show in my browser? i get a small box with a red x in it. I am a novice what' s causing this? thanks

  11. #86
    SitePoint Member
    Join Date
    Mar 2007
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This does not work in the new firefox 2 for some reason, what the hell? Isn't it all server-sided???

  12. #87
    SitePoint Enthusiast
    Join Date
    Sep 2005
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I know this is an old thread, but for all of you who want to apply watermarks on the fly, you might want to check the open-source project Asido: there are a lot of useful features when creating applying watermarks, like tile watermarks or watermark scaling. There's no problem at all using transparent images both as watermarks or as images that are about to be watermarked. Here's a brief example copied from Asido website:

    PHP Code:
    <?php
     
    /**
    * Include the main Asido class
    */
    include('./../../class.asido.php');
     
    /**
    * Set the correct driver: this depends on your local environment
    */
    asido::driver('gd');
     
    /**
    * Create an Asido_Image object and provide the name of the source
    * image, and the name with which you want to save the file
    */
    $i1 asido::image('example.jpg''result_01.jpg');
     
    /**
    * Put a watermark image 
    */
    Asido::watermark($i1'watermark_01.png');
     
    /**
    * Save the result
    */
    $i1->save(ASIDO_OVERWRITE_ENABLED);
     
    ?>
    You can see the results here: http://www.asido.info/howto/watermark/gravity/

  13. #88
    SitePoint Zealot
    Join Date
    Jul 2005
    Location
    Osoyoos BC Canada
    Posts
    178
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up

    I too failed to get the origional script to work... But after reading all your posts today about asido, I downloaded asido this afternoon from soundforge and hey! It works!!

    The only thing it did that confused me was it made my watermark way smaller, but digging through the examples I found that by default it reduces the watermark to 25%. This reduction can be eliminated by adding:--

    Code:
    , ASIDO_WATERMARK_SCALABLE_DISABLED
    and, even neater, a custom scale can be added, for example 66%:-

    Code:
    , ASIDO_WATERMARK_SCALABLE_ENABLED, 0.66
    If you want to watermark images then give asido a try.

  14. #89
    hellcat
    SitePoint Community Guest
    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);

    ?>

  15. #90
    SitePoint Enthusiast
    Join Date
    Sep 2005
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by colinmcc View Post
    ...

    The only thing it did that confused me was it made my watermark way smaller, but digging through the examples I found that by default it reduces the watermark to 25%
    Yeah, indeed the default behaviour is to have the watermark scaling ON and 1/4 scaling factor, and this is because in most cases you don't need your watermark to be bigger then the image you are watermarking. Anyway, I am glad that you find Asido useful, and even more that you find the information on the website is helpful - I don't want to be one of those open-source projects that lack comprehensible documentation.

    Recently I've been thinking about how to improve the watermark scaling. Right now the scale factor is applied to the watermark image without any regard to the image being watermarked. Let me show you an example: you have an image that is 100x100, and you have a watermark that is 800x800; since the watermark is bigger, the watermark scaling will try to reduce it by the defautl scaling factor, which 0.25 (1/4), so the watermark will become 200x200 and it will be still bigger than the image that's about to be watermarked. The solution
    is to tie the scaling factor not to the dimensions of the watermark, but to the dimensions of thre image, so when the scaling factor is 1/4, this means that the watermark will become 1/4 from the size of the watermarked image. Using 100% (1.0) as scaling factor will cover the whole image w/ the watermark. Anyway, I don't want to drop the way the scaling is applied right now, so probably there will be a new "mode" for the scaling, and the available options will be: ASIDO_WATERMARK_SCALABLE_DISABLED, ASIDO_WATERMARK_SCALABLE_ENABLED_TARGET (current implementation) and ASIDO_WATERMARK_SCALABLE_ENABLED_SOURCE (the feature I just explained)

  16. #91
    joe
    SitePoint Community Guest
    good

  17. #92
    Tony Gilbert
    SitePoint Community Guest
    If I wanted to add this script to a CMS, what would be the easiest way to call it into the existing code? Would I "include once" on the script in the header and use variables where you have the $GET statements? And how would I then transfer the watermarked image to my TPL file for diplay?

  18. #93
    Jason
    SitePoint Community Guest
    You may actually want to use:
    imagecopy($image, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height);

    instead of imagecopymerged()

    For some reason there was some problems using imagecopymerged(). The watermark was converted into a jpg then merged without transparency.

  19. #94
    eddie
    SitePoint Community Guest
    I found anothe r script that used htaccess to autmoattically wrap any image called.

    it used;
    addhandler wtmrk jpg
    action wtmrk watermark.php

    Any idea how to achive this here?

  20. #95
    eddie
    SitePoint Community Guest
    This only works for jpg's?

    I can not get it to work for gif's.

    Any ideas?

  21. #96
    Roflo
    SitePoint Community Guest
    To make it work for GIFs, you should use imagecreatefromgif() instead of imagecreatefromjpeg().

    While browsing PHP.net's site I stumbled upon a user's snipplet for a function named imageCreateFromFile() somewhere in:
    http://es.php.net/gd

    I use a modified version of it.

  22. #97
    SitePoint Member
    Join Date
    Nov 2007
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    really great post!

  23. #98
    matt
    SitePoint Community Guest
    i can't get this to work...

    here's what I did...

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

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

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

    $image = imagecreatefromjpeg($_GET['originalImage.jpg']);

    $size = getimagesize($_GET['originalImage.jpg']);
    $dest_x = $size[0] - $watermark_width - 5;
    $dest_y = $size[1] - $watermark_height - 5;

    imagecopymerge($image, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height, 100);

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

    am i missing something obvious? i don't really write php!

    please help!

  24. #99
    vv
    SitePoint Community Guest
    can't watermask animated gif.

  25. #100
    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:))


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
  •