Accueil // Hotlink 2 Watermark

Hotlink 2 Watermark

Page pour le support du plugin Wordpress Hotlink2Watermark.

Pour télécharger le plugin, ca se passe ici : http://wordpress.org/extend/plugins/hotlink2watermark/

Cette page vous permettra de suivre le support du Plugin Wordpress Hotlink2Watermark.

Fonctionnalités du plugin Hotlink2Watermark:

Fonctionnalités du plugin :

  • ajout d’un watermark sur les images hotlinkées, a la volée
  • cache des images générées dans un répertoire
  • choix du watermark (texte/image)
  • modification du .htaccess si nécessaire
  • création/effacement du répertoire de cache à l’activation/désactivation du plugin
  • sauvegarde des referers dans un fichier csv
  • choix des couleurs pour le texte et l’ombre (pour les watermark textes)
  • possibilité de désactiver l’ombre(pour les watermark textes)
  • Possibilité de choisir la police de caractère(pour les watermark textes)

Qu’est ce qu’une image Hotlinkée ?

C’est une image hébergée sur votre site, mais qu’un webmaster « indélicat » affiche également sur son site, tout en gardant l’hébergement chez vous (il ne la recopie pas chez lui). Du coup, cela utilise la bande passante de votre serveur sans vous apporter pour autant des visiteurs.

Ce plugin permet d’ajouter à la volée un filigrane (watermark) sur ces images, uniquement quand elles sont affichées sur les autres sites (ca ne modifie nullement l’affichage de vos images sur votre site)

Comment fonctionne t-il ?

Grâce à une règle de réécriture dans votre fichier .htaccess, toutes les demandes d’images venant des autres sites sont redirigés sur un fichier du plugin qui va prendre l’image demandée, y ajouter un filigrane, et la sauver dans un cache (pour éviter de faire plusieurs fois la même manip pour la même image). Il va ensuite renvoyer l’image modifiée au serveur qui la demande.

Comment savoir si vous avez des images Hotlinkées ?

Grâce a Google Images, vous pouvez le savoir trés facilement. Il suffit de taper comme requête dans Google Image :

inurl:urldemonsite -site:urldemonsite

Pour Tranches du Net, ca donne cela :

inurl:www.tranchesdunet.com -site:www.tranchesdunet.com

Ça me donne à l’heure ou je rédige ce billet 4880 images hotlinkées ailleurs… Mais grâce à ce plugin, ces 4880 images vont s’afficher avec l’adresse de tranchesdunet.com en filigrane ! :)

65 commentaires

  1. How do I change your plugin to english so I can use it?
    Please email me at healthypeopleproducts@gmail.com
    People are stealing my photos and I need to stop that. Thank you.

  2. Hi,

    I’m not sure of what you wanna do. If you just want to switch the plugin in english, the plugin use the line in your wp-config.php :
    define ('WPLANG', 'en_EN');
    In case you don’t have this line in your wp-config.php, you can add it in the appropriate section. In case you have something different than ‘en_EN’ in this line, you can:
    – change this to ‘en_EN’ but it could make problems with others plugins
    – get the value you have, and change the name of the translate files located in /wp-content/plugins/hotlink2watermark/lang hotlink2watermark-en_EN.* with the appropriate suffix. E.g. if you have
    define ('WPLANG', 'en-US');, you have to rename files
    hotlink2watermark-en_EN.mo -> hotlink2watermark-en-US.mo
    hotlink2watermark-en_EN.po -> hotlink2watermark-en-US.po

    Hope it will help!

  3. Need instructions in English, please! At least give us an option for changing the language on it!

  4. Hello,

    I understand your request. I’m gonna change the default language (which is french) to english. Please, allow me 2-3 days for this. Also, you can try the solution below, in my answer to Marcia.
    Thanks

  5. Ok, so it was faster than I though first. A new version is available online with English as the default language. Let me know if everything is ok.

    Best,

  6. Hi, I installed your hotlink2watermark plugin yesterday. This morning I checked some sites that have been hotlinking my images and I can’t see the watermark ?
    Also I enabled the « save the referers » option and nothing is being populated in the referer.csv file.
    Within my .htaccess file the plugin settings are situated at the very end.
    Can you let me know what I’m missing ?
    Merci
    David

  7. Hi!

    I can see an image from your site with a watermark on this page for example: Is it the right watermark you’ve set up?
    The location of the settings in the .htaccess is not important until there is no other « image redirection » in your .htaccess before it.
    For the referer.csv, did the file has been created by the plugin? Is there any error message telling the file cannot be written?

    Hope it will help!

  8. The watermark that you see is the one I embed on all my images. The watermark that I set in the plugin is « This image has been HOTLINKED from http://www.sysadmintutorials.com » – Just the text, no additional images.
    yes, the referer.csv file is created in the plugins directory. I cannot see any error message in the plugin settings, is there anywhere else I can look ?

  9. Thank you for your answer!
    – For the referer.csv, I suppose there is no more records than before?
    – For the watermark: I’ve notice that sometime, if the « generated watermark » is bigger (in width and/or height) than the targeted image, they doen’t merge. Could you try with a shorter watermark, just for test.
    Also, as I said in the doc, don’t forget to « ctrl + F5 » on the hotlinker website, because sometime an already cached version is displayed instead of the new one.
    Let me know if it solve the problem :)

  10. bonjor, j ai installer Hotlink2Watermark sur mon wordpress, cependant ca ne marche pas. peut etre mauvaise installation. je suis debutante mais c est assez urgent car ce sont des photos pour un site d une association pour aider les enfants atteint du cancer. j ai pas mal de photos sur plusieurs liens differents.
    pouvez vous m aider. j ai activer et mis en place l extensions
    – reglages du texte : Protégé par Association Noah Baroni
    – taille : 16
    – angle du texte : 0
    – url de l image : j ai mis l adresse du site
    …etc le reste j ai pas touché.
    je dois peut etre inserer un tag ou autre ?

    merci

  11. Bonjour,

    Pour url de l’image, il ne faut pas mettre l’url du site, mais le chemin complet vers une image qui servira de watermark SI vous ne voulez pas faire de watermark texte. Si il y a un contenu dans « url de l’image » c’est ce qui sera utilisé pour générer le watermark. Dans votre cas, vous devriez laisser vide ce champs et voir si cela corrige le problème.

    Cordialement,

  12. The referer.csv file is empty, no records at all in it.
    I will try with a smaller font as you suggest.
    Yes I’ve hit ctrl + F5 multiple times but still no watermark

  13. Hi, i’ve tried to reduce the font but still nothing, any other ideas ?

  14. Hi! No better idea for now but I’ll try to make a new version with some « debugging tool » included to find what’s going on.
    Allow me 1 or 2 weeks to do this 😉

  15. I’ve tried a few things that may help debug.

    In htaccess, if I move the plugin rewritecond and rewriterule around, the plugin seems to work but my site stops. Under # BEGIN WordPres I have a few lines but these ones in particular:
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ – [L]
    If I place the your plugin before RewriteRule ^ – [L] the plugin seems to work but my site stops, if I place it after RewriteRule ^ – [L] my site works but the plugin stops. Any idea ?

  16. Thank you for your investigation :)
    My .htaccess default wordpress rules are as follow:
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

    And are at the very end of the file. You may notice some differences (e.g. the « ! » before -f and -d , no [OR] attribute, etc.)
    May I suggest you to try these settings as they are the default Wordpress settings? Maybe a specific theme or a plugin have change them?

  17. So does the hotlink2waterk plugin settings in .htaccess sit before # BEGIN WordPress or after # END WordPress

  18. The hotlink2watermark settings should normally be anywhere in the .htaccess as it only affect the images called from outside of your site. On my websites, it is set before the #begin wordpress, and it’s wordpress itself which put it there…

  19. Hi,
    Would this plugin conflict with this plugin? http://wordpress.org/extend/plugins/imagemagick-engine/

    When i check the hotlinked sites all i see is an error for my image instead of a watermarked image.

    Could the above plugin be causing that? Thanks!

  20. Hi,

    I don’t know this plugin, but as far as I can see on its page, it replace the original GD lib, used by Hotlink2watermark with its own library. So it might be incompatible if it disable the use of GD Lib.
    Maybe you should try to use it without the « imagemagick-engine » enabled just to see. (I’m sorry, but I cannot do test on my own until a couple of days).
    Let me know if it fix the problem :)

  21. Hi,

    I installed this plugin and hotlinked one of my own images from a different domain to test it. However, when I go to view the image, it doesn’t show up. It’s as if the site is linking to a non-existent image. When I visit /wp-content/plugins/hotlink2watermark/h2w_target.php?pic=wp-content/uploads/image.jpg manually, Chrome gives me an error stating that the file doesn’t exist.

    I used an htaccess rewrite tester and the output URL is correct, so I know the rewrite is working properly. I think there is an issue with h2w_target.php creating the actual image. I made sure the cache folder had the proper ownership and permissions, but nothing changed. I do notice that nothing is being created in the cache folder even though (I think) the plugin is set to use it.

    Any ideas?

    I’d give you specific examples but I run a website with adult content on it and I’m not sure if you mind if I post it here.

    Thanks!

  22. Hi,

    Thank you for your complete report. Do you have anything in the log file? (referer.csv)
    And, maybe, you could try to comment the lines 47 and 48 in the h2w_target.php
    header("Content-Type:{".$mime."}");
    header("Content-Transfert-Encoding: binary");

    Sometimes, it helps, but I don’t know why :(
    If not:
    – the plugin use the GD Lib for creating the image. Is it enable in your server?
    – for text watermark, the plugin use the ImageTTFBBox function. Do you use image watermark or text watermark. And if so, do you know if this function is enable in your server?

    Let me know if it resolve the issue.

  23. Hi,

    I just installed the GD library and now the image shows up! Thanks :) Maybe you could add a check to the code to make sure the library is installed and present a warning message to users that it needs to be installed for the plugin to work? It would also be helpful if that was in a troubleshooting FAQ in the readme file.

    There’s still one problem. Even though the image shows up, the watermark is not appearing on the image.

    To answer your question, the log file is working properly and displaying everything it should be.

    I’m using text watermarks, but I can’t seem to determine if ImageTTFBBox is enabled on my server. I checked phpinfo() and it shows that GD and Freetype are enabled, but there’s nothing about that function.

    Any other ideas?

    Thanks!

  24. I’ll put a check for the GD lib in the next release, thanks for that!
    For the other issue, if you have the GD Lib and Freetype enabled, the ImageTTFBBox should work. So I think it’s not the problem.
    Maybe your watermark text is too long and exceed the length of the picture. Could you please try with a shorter text and/or lower font size?
    Thanks!

  25. I tried with just the word « Test » but it didn’t work.

  26. Hi Silent Bob,

    I figured out the problem. The plugin code references « verdana.ttf » but the file that comes with the plugin is « VERDANA.TTF. » Since Linux is case sensitive, it can’t find the font file. If you rename the font file in the fonts folder to « verdana.ttf » that should fix problems for a lot of people.

    Thanks!

  27. Oh, one more thing. « Content-Transfert-Encoding » isn’t a valid HTTP header. It should read « Content-Transfer-Encoding ». The former is a common misspelling among speakers of the French language and may explain why some people have problems with the headers not being commented out.

    Hope this helps!

  28. Thank you VERY MUCH for your help. I hope it will help anybody who may encounter issue with this plugin. Everything will be fixed in the next release which should be online in a few days.
    Thank you again!

  29. Hi!
    Please add date+time field to referer.csv.
    And I’ve edited your code to allow fonts up to 40 pix for myself :)

    Thank you for your work!

  30. Thank you for your comments. The date & time will be added in the next release.
    For the 15″ issue, thank you to notice it, but I will not change the width of my site as 15″ resolution is not very used anymore. And for smartphone/tablet device, there is a specific theme on this site, which is easier to watch.
    Thank you again for your notes. :)

  31. Btw, can’t view and access some widget at the left on your site from 15″ monitor

  32. Hallo.

    For security reason I changed my content directory (I use Better WP Security plugin). That why Hotlink2Watermark doesn’t work on my site. Hope this will be fixed on next update.

  33. Hi!
    Thank you for your feedback. After a quick check, I think the only location where the path to /wp-content is written without using Wordpress constants is in the .htaccess:
    RewriteRule (.*)\.(gif|jpe?g|png)$ /wp-content/plugins/hotlink2watermark/h2w_target.php?pic=$1.$2 [L]
    Could you try to change the path here accordingly to your new path and see what happen? Let me know if it solves the issue or not :)

  34. I don’t want to edit my .htaccess because I ever have bad experience that cause my website fail to show up. Maybe this information can help:
    http://wordpress.org/support/topic/renaming-moving-wp-content

  35. Ok, I understand. I’ll try to make a fix for the next release 😉

  36. Hi, thanks for this plugin.
    It is working not correctly.
    Is there a specific place where the watermark image should be?
    The watermark does not appear on the hotlinked images.
    The image is no longer hotlinked, it’s disappeared… that’s a nice effect too :-)
    But how do I get the watermarkimage to appear over the picture? I used a png file as watermarkimage, that should be nop problem I guess.

  37. Hi,

    Could you make some tests:
    – set up the text only watermark, with a low size (and so delete the path of the watermark picture), and see if it works
    – if so, make sure your watermark image is not bigger (in width and/or height) than your images
    – also, make sure you have granted all write access on the « cache » directory, under the « hotlink2watermark » plugin directory.
    Let me know if it solve the problem.
    PS : the plugin will work with any of the following files : PNG, GIF, JPG

  38. By the way: I did all checks.
    GD is working, etc.

  39. Hi, thanks for your reply.
    with text watermark 10px (8 letters long), there is no result.

    On some sites there is no image anymore, just like before.
    On sites where the image is back now, there is no watermark.

    The cache directory is writable, but it’s empty.

  40. Hi, thanks for testing.
    Can you tell me if you have something in the « referer.csv » file (under Hotlink2watermark directory)?
    Also, you may have somes lines in you .htaccess file (on your website root folder) which prevent the lines from my plugin to work properly. E.g. some lines which control the rewriting rules for images files before mines. I know sending your .htaccess content could present some « security » issues but it could allow me to check for this. If you’re ok with this, you could use the contact form of the current site.

  41. Salut, Bravo pour ton plugin.
    J’ai une petite question, pense tu pouvoir le rendre compatible avec la fonction Multi-Site de WordPress ?

    Car actuellement nous possédons plusieurs Sites différents sur le même WP et il nous faudrait donc pouvoir gérer plusieurs filigranes (un pas site!). Pense-tu que c’est envisageable ?

    merci et bonne continuation !

  42. Salut, et merci pour ton commentaire.

    Je n’ai jamais utilisé wordpress multi-site, mais cette fonctionnalité pourrait être intéressante, en effet. Malheureusement, j’ai une todo-list assez conséquente sur différents projets, et je ne pense pas pouvoir m’y atteler avant plusieurs mois :( (a moins de trouver une façon rapide de le faire, mais a priori cela nécessite de revoir l’interface d’admin pour inclure des paramètres par site, donc plutôt complexe).

    Je rajoute néanmoins cela dans ma todo-list, pour la prochaine version :)

  43. Salut et merci pour ta réponse.

    Content que tu y soit réceptif, il faut dire aussi que les plugins de watermark compatible avec la 3.4.2 de WP ne cours plus trop les rues, et le peu qui prennent le WPMU en compte ne sont plus mise à jours depuis des lustres… Il n’en reste qu’un qui est devenu payant et qui n’assure même pas d’être compatible dans un avenir proche, d’autant plus que sa version gratuite n’est pas mise à jour elle non plus.

    Je croise les doigts pour que tu continue ton formidable travail sur Hotlink2Watermark.

    @+

  44. Hi,

    Thanks for writing this plugin, was very happy when I found it! I have made a couple changes to it for some hot linking issues I had. I was having people hot link directly to my photos without a referred entry in my apache logs. With the current .htaccess they could go directly to the photos. So I commented out this line:

    RewriteCond %{HTTP_REFERER} !^$ [NC]

    With the line commented out then direct links to my photos would go through your plugin. But for some reason the plugin wouldn’t create the watermarked image when I made this change. If the image was already in the cache, it worked fine. If it wasn’t in the cache then it would hang trying to create the image.

    To solve this problem I then edited h2w_target.php. I changed these lines:

    if(!preg_match(‘/http:\/\//’, $image))
    {
    $image = get_bloginfo(‘url’). »/ ».$image;
    }

    to just this:

    $image = $root . ‘/’ . $image;

    I also found that I needed to set the header for the watermarked image that was being sent back. So I changed this:

    if ($fp) fpassthru($fp);

    to this:

    if ($fp) {
    $gis = getimagesize(« ./cache/ ».$md5_name);
    $mime = $gis[‘mime’];

    header(« Content-Type: « .$mime. » « );

    fpassthru($fp);
    }

    And now everything works great! Direct access or hot linking to the image will return the water marked image. But accesses that come from my own website in the referred field, those will return the image without the watermark. Hopefully these are changes that can help others too.

    Thanks again,
    Kevin

  45. I’ve made a couple more changes to the code. I noticed that the watermark text being added to the image didn’t look smooth, like the anti-aliasing wasn’t working correctly. After looking into it I found out that when the watermark was combined with the target image the alpha channel wasn’t being properly applied. The solution was to create the text as transparent text and then use imagecopy to combine the two images. Here’s the changes to do. Change these lines:

    $black = imagecolorallocate($watermark, 0, 0, 0);
    $white = imagecolorallocate($watermark, 255, 255, 255);

    to this:

    $black = imagecolorallocatealpha( $watermark, 0, 0, 0, 127 * (100 – $h2w_opacity) / 100 );
    $white = imagecolorallocatealpha( $watermark, 255, 255, 255, 127 * (100 – $h2w_opacity) / 100 );

    Then change this line:

    imagecopymerge($target, $watermark, $dest_x, $dest_y, 0, 0, $wm_w, $wm_h, $h2w_opacity);

    to this:

    imagecopy($target, $watermark, $dest_x, $dest_y, 0, 0, $wm_w, $wm_h);

    You should notice the watermark is much smoother on the image now.

  46. Just realized the changes I just posted will only work for a text watermark. If you provide a watermark image then it won’t get the correct opacity. It’s an easy fix, just need to check if the user is using a watermark image or not. So change the imagecopy/imagemerge to this:

    if($h2w_img && getimagesize($h2w_img))
    imagecopymerge($target, $watermark, $dest_x, $dest_y, 0, 0, $wm_w, $wm_h, $h2w_opacity);
    else
    imagecopy($target, $watermark, $dest_x, $dest_y, 0, 0, $wm_w, $wm_h);

  47. all I’m getting with this plugin is text gibberish, though I can see that the image is being properly created in the cache folder. Are the mime types being sent in the headers?

  48. Hi,

    Yes, the headers (content-type & content-transfer-encoding) are sent with the image.
    Can you show me a sample (url) of what you get?

    And Maybe you have another plugin which conflict with mine?

  49. I was getting the text gibberish also. I checked with the program furl by accessing the image url and for me the header wasn’t set properly. The header was marked as being html. When I edited h2w_target.php by changing this line:

    if ($fp) fpassthru($fp);

    to this:

    if ($fp) {
    $gis = getimagesize(« ./cache/ ».$md5_name);
    $mime = $gis[‘mime’];
    header(« Content-Type: « .$mime. » « );
    fpassthru($fp);
    }

    It started working for me.

  50. Thank you for great plugin!
    I think it will be a good idea to add some settings to admin page:
    -font family
    -text color
    -shadow on/off
    -shadow color

  51. Hi Guys,

    As you may notice, I’ve just released a new version of this plugin. It includes several improvements, like better antialiasing, better .htaccess rules, choice of color for text and shadow, choice of font, etc…

    Have fun with it!

  52. Hi! Excellent work. But i have an error:
    PHP Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM in hotlink2watermark/h2w_target.php on line 87

    So i’ve changed :: to -> and it work!

  53. Hi,

    Thanks for your correction. There were no error on my test platform but I update the source anyway. The updated version is available on wordpress.org now!

  54. Same error as @m1rage when I try to see an image on an other site but I don’t know what I can change to stop this error !

  55. Bonjour,

    Je viens de mettre le correctif en ligne, si vous pouvez essayer de le telecharger. Merci

  56. I just have problems. When I activate the plugin and update the plugin, then all hotlinked-images are not working… The browser just tries to download the file and I can’t view this image.

  57. Hi,
    I need some more info to fix this issue:
    – did you delete the files in your « cache » folder? You can do it as this new version need to regenerate all the files. And then, did the plugin generate new files?
    – did you deactivate the old version before upgrading? Especially, I need to see your .htaccess content to check any possible conflict. Instead of posting your .htaccess content in the comment, you can send it to me throught the contact form.
    Thanks

  58. I use W3 Total Cache and host my files on a CDN (Amazon S3). I found that your plugin works for the files that are not hosted on the CDN but it doesn’t work for the files on the CDN.

    Is there anyway to force it to work with the CDN files?

    Kind Regards,
    Penny

  59. As I’ve never use a CDN, i’m not sure if I can do something.
    Maybe you can try to add a rules in your .htaccess on the hotlink2watermark section with something like:

    RewriteCond %{HTTP_REFERER} ^http://yourCDNdomain/.*$ [NC]
    (do NOT add the ! before the ^)

    (just after the line: RewriteCond %{HTTP_REFERER} !^$ for example)
    and see what happen!

    Let me know if it works (or not) :)

  60. Penny,

    Did the advice for S3 work for you? I am using S3 via W3TC too and would want to use this plugin too.

  61. hello, I can’t use png with transparent color. it will be filled with shadow color (black or white)… how can I use transparent parts?

  62. Hi,

    I really don’t have time to make any tests right now BUT you could try to change some lines on the file h2w_target.php (on the plugin directory) and maybe let me know if it works (it should):
    change lines 180 to 185:
    if($h2w_img && getimagesize($h2w_img))
    {
    imagecopymerge($target, $watermark, $dest_x, $dest_y, 0, 0, $wm_w, $wm_h, $h2w_opacity);
    }else{
    imagecopy($target, $watermark, $dest_x, $dest_y, 0, 0, $wm_w, $wm_h);
    }

    to

    imagecopy($target, $watermark, $dest_x, $dest_y, 0, 0, $wm_w, $wm_h);

    Thanks

Laisser un commentaire

Votre adresse de messagerie ne sera pas publiée. Les champs obligatoires sont indiqués avec *