Le fichier .htaccess ne peut pas ajouter de filigranes à vos images. Cependant, cela peut restreindre l'accès à vos images.
Cependant, vous pouvez ajouter des filigranes à l'aide de PHP GD Library. Le code ci-dessous vous montre comment ajouter un filigrane à votre image via PHP GD.
<?php
// Load the stamp and the photo to apply the watermark to
$stamp = imagecreatefrompng('stamp.png');
$im = imagecreatefromjpeg('photo.jpeg');
// Set the margins for the stamp and get the height/width of the stamp image
$marge_right = 10;
$marge_bottom = 10;
$sx = imagesx($stamp);
$sy = imagesy($stamp);
// Copy the stamp image onto our photo using the margin offsets and the photo
// width to calculate positioning of the stamp.
imagecopy($im, $stamp, imagesx($im) - $sx - $marge_right, imagesy($im) - $sy - $marge_bottom, 0, 0, imagesx($stamp), imagesy($stamp));
// Output and free memory
header('Content-type: image/png');
imagepng($im);
imagedestroy($im);
?>
timbre $ est le contenu que vous voulez être sur filigrane (par exemple: droits de reproduction réservés) et $ im est l'image réelle qui doit être protégée.
Je ne pense pas que ce soit possible avec htaccess. Vous devrez probablement rediriger l'utilisateur vers un script (PHP, etc.) qui a filigrané l'image. –
ok je peux d othis maintenant! mais je veux détecter la demande étrangère venant à mon hôte d'un autre site web !! – bizzr3
@bizzare Vérifiez le champ de référence de la requête. – Cheery