RewriteEngine on //Disallow blank referrers, but I recommend to not use it. RewriteCond %{HTTP_REFERER} !^$ [NC,OR] //Sites allowed to link your images RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yourdomain.com [NC,OR] RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yourdomain2.com [NC] //Change ‘http://hpmouse.googlepages.com/hotlink.gif‘ to a image you’ve set, and whenever image hotlinking is detected, RewriteRule \.(jpg|jpeg|png|gif)$ http://hpmouse.googlepages.com/hotlink.gif [NC,R,L]
Показаны сообщения с ярлыком hotlink. Показать все сообщения
Показаны сообщения с ярлыком hotlink. Показать все сообщения
воскресенье, 21 июля 2013 г.
Prevent hotlinking with .htaccess
суббота, 20 июля 2013 г.
Sign your hotlinks - Watermark on the Fly in PHP
Yon need PHP 4+ and GD 2.0+ on your server
<?php header('content-type: image/jpeg'); $watermark = imagecreatefrompng('watermark.png'); $watermark_width = imagesx($watermark); $watermark_height = imagesy($watermark); $image = imagecreatetruecolor($watermark_width, $watermark_height); $image = imagecreatefromjpeg($_GET['src']); $size = getimagesize($_GET['src']); $dest_x = $size[0] - $watermark_width - 5; $dest_y = $size[1] - $watermark_height - 5; imagecopymerge($image, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height, 100); imagejpeg($image); imagedestroy($image); imagedestroy($watermark); ?>
“RewriteCond $1 ^.*.(jpg|jpeg|gif|png|bmp)$” Or with no rewritecond the rewriterule should be: “RewriteRule ^.*.(jpg|jpeg|gif|png|bmp)$ /scripts/watermark.php?src=%{REQUEST_URI} [L]”
Подписаться на:
Сообщения (Atom)