Automatic watermarks in WordPress

If you regularly use original images on your website, it will not be fun to find them on other sites, or at least if they appear who made the photos or created the images .

Regardless of the systems for avoid content theft it is worth adding the ones known as " watermarks "In your images.

And much better if we do it automatically, right?

Well what you have to do is create a function which you will add to your function plugin or file fucntions.php of the active theme.

You have it just below, with a function watermark () that takes into account 3 parameters ( $ SourceFile $ WaterMarkText $ DestinationFile ) that create a watermark image from the specified source image. The first parameter – $ SourceFile – is the complete server path to the image that will serve as a watermark. The second – WaterMarkText – is the text message you want to add as a watermark. And the last parameter – $ DestinationFile – you can leave it blank or put the full path to a new file that would have both the source file and the watermark text on it.

What does this function is to read the source file, then create a new image object, using the function imagecopyresampled () . Then, using the font " arial.ttf " and the function imagettftext () write the WaterMarkText in the image. The last statement IF checks whether the file should be saved with a watermark or if it should only be displayed on the screen.

You will have than download the source file " arial.ttf " and upload it to your server. Then copy and paste the previous function in the function plugin. The next 4 lines which you also have to add to your function plugin, are used to define the source file, the text message of the watermark and the destination file. If you only want to show the image as a watermark then you leave the variable $ DestinationFile empty ( $ DestinationFile = ''; ).

Make sure that for the source file and destination you have to include the full path of the server and also the name of the file. If you change the position of the message for the watermark in your images you have to change the line imagettftext ($ image_p, $ font_size, 0, 10, 20, $ black, $ font, $ WaterMarkText); .

PHP Code seen on phpjabbers

Mola true? What? … yes, that's cool …

Vaaaaaaale, I know, you want to make it easier. Well nothing, to pull plugins . If you are wandering then try some of these plugins in case they do the fix, but do not say you have not learned to do it in "pro mode" eh!

  • Bulk watermark : it's a bit of a beast but it works, what it does is add a watermark to ALL the images that you have uploaded to your WordPress, without questions or explanations, you cheer up and do it. Very useful if you have realized late that you should add this type of protection to your images.
  • Watermark reloaded : similar to the previous one, quite configurable and effective. Its function is to add a watermark to the existing images in your WordPress.
  • Signature watermark : very nice and customizable, because you can add text and image watermarks, with a really complete options panel, it would be the ideal substitute for the code
  • Watermark my image : this adds to the possibilities of the former the virtues of the first one, since besides adding watermarks to the new images it also offers you the possibility to add it to all the images that already you had previously uploaded to your WordPress. Less configurable than Signature but more complete.

Ea, that's it, you mark it well!

NOTICE : this publication is from two years ago or more. If it's a code or a plugin it might not work in the latest versions of WordPress, and if it's a news story it might be obsolete. Then do not say we have not warned you.

Loading …

That may also help you: