The watermark on all images of site
Owners of sites (forums, message boards, etc.) are often faced with the problem of creating a watermark on all large images of site.
Of course, the solution is to manually create a watermark on each image, however, firstly, it takes a long time, and secondly, there is a need to keep two versions of the images with a watermark without him.
The solution can serve as a dynamic overlay a watermark on the image before sending it to the visitor site.
The Internet is a solution to this problem in two files whose contents are listed below.
The source code of the file ".htaccess"
The source code of the file "_watermark.php"
The solution reduces to the following in a directory with image files placed the file ".htaccess". Besides it, the server creates a folder "watermark", which is a script file "_watermark.php" and the actual file of the watermark "watermark.png".
At the same time, in comparison with the original version was encountered on the Internet, minor changes were made in both text file by me.
In the file ".htaccess", a regular expression search of image files added extension "jpeg", as too frequent.
Script "_watermark.php" reworked in such a way as to place the watermark in the center of the image (this required a specific problem to be solved) and the added ability to adjust the transparency created by the watermark (the comments in the body of the script will help you customize this setting).
Should also pay attention to the fact that putting the folder "watermark" in a folder with images, as suggested the original sources, we will not achieve the desired result because in this case, we will have in each folder its own file ".htaccess" and the folder "watermark". This is due to the fact that the file ".htaccess" specifies the absolute path from the root directory of the site to the file "_watermark.php". Thus, having in each folder with the images of individual sub-folder "watermark", in case you need to change the watermark (or a script, juxtaposing it with the image), we have to make changes to all folders.
To avoid this problem, I recommend creating a folder "watermark" in the root directory of the site, and a directory of images to place the file ".htaccess" without the need to change it every time. In this case, to change the watermark or the script we will need to make changes in only one place of the site. Create different watermarks for different folders with images in such a case, you can reference from different files ".htaccess" on the different scripts, e.g. "_watermark-1.php", "_watermark-2.php" etc.
Thus, summarizing, we can say that for the imposition of a watermark on all images of the site to download the attached file, unzip it, the folder "watermark" placed in the root directory of the site, we replace the file of the watermark "watermark.png" to your own, and the file ".htaccess" to put in those files on the web, images of which should be marked watermark.
Download the archive containing all the necessary files at this link.