2011-11-17 62 views
0

这是很好的磁提供图片的水印所以水印图像将显示为保护Magento的图像

http://www.yourwebsite.com/media/catalog/product/cache/1/image/de684549e4151748e56ee0dd7902c19f/m/y/my-first-image.jpg 

这是一件好事。但是,如果有人删除缓存/ 1 /图片/ de684549e4151748e56ee0dd7902c19f URL的一部分,使之成为

http://www.yourwebsite.com/media/catalog/product/m/y/my-first-image.jpg 

他可以查看图像,并将其复制。解决这个问题的最好方法是什么?

回答

0

那么,创建自己的图像与水印!就像如果删除缓存,缓存会从已经水印图像

0

重建图像您可以在其中创建媒体/目录文件夹的.htaccess文件有以下几行:

Options +FollowSymLinks 
RewriteEngine on 

RewriteRule ^(.*?/cache.*)$ $1 [L] 
RewriteRule ^(.*)$ $1 [F] 

如果用户尝试查看原始文件,但是让他们看到缓存中的图像,则会向用户返回403。

这会中断预览管理中的图像,因为它们显示的是原始文件而不是生成的缩略图。

+0

谢谢Jasuten!我可以通过下面的答案发布一些细微的修改。 – Farrukh

1

这就是我设法做到的。

在它把一个.htaccess文件中media/catalog/夹在Magento与下面的代码

Options +FollowSymLinks 
RewriteEngine on 
#Following line allows the actual images to be accessed by admin end directly 
RewriteCond %{HTTP_REFERER} !^http://www.yourwebsite.com/.*$ [NC] 
#Following line allows the watermarked images to be accessed directly. Rule says that if URL does not contain cache 
RewriteCond %{REQUEST_URI} !(/cache/) [NC] 
#This is the page where visitor will be redirected if tries to access images directly. 
RewriteRule \.(gif|jpg)$ http://www.yourwebsite.com/do-not-try-to-steal-images.html/ [R,L]