Answer the question
In order to leave comments, you need to log in
Insert watermarks in photos
Tell me how best to insert watermarks in the photo
Answer the question
In order to leave comments, you need to log in
If you are better with C/C++ than with PHP/Ruby/Python (or whatever you write the server side on), then point #3.
If your skill in the server language is higher or equal to C / C ++, then of course the second option.
Same for the second option. Here on Habré it was already considered how to make a watermark.
you answered your own question: store two instances (the original outside the web directory), with a watermark in the target.
process photos in the process of adding: added a new product, saved the original image, applied a sign, saved.
in general KISS
As I did.
1. I wrote a rewriterule in .htaccess so that all image accesses are transferred to a special php script.
2. The script checked if there is a picture with a watermark in the cache
2.1 If there is, then it gave this picture through readfile()
2.2 If not, then put a sign and save it to the cache. We output again, via readfile()
And here is the rule for .htaccess We
check that it is a jpg or jpeg image ...
... so that this image is not requested from the admin panel and ...
... we send a request to the script
In the script, the image is available in $ _SERVER ['REQUEST_URI']
RewriteCond %{REQUEST_URI} \.(jpeg|jpg)
RewriteCond %{HTTP_REFERER} !textpattern
RewriteRule \.(jpeg|jpg) /images/watermark/index.php [NC]
Of course, you need to generate images with watermark as they arrive (it can be delayed if there are a lot of images) - but not as requested. On the fly - you run the risk of getting "hurt".
I would write a cron script that fetches all files by find, with the last modification less than or equal to the call timeout of the cron-rule itself, and then use the console imagik. He copes with this task with a bang.
Total - the solution to your problem fits in one line
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question