nicutdk
08-19-2010, 05:09 AM
Hi,
I have this script and works fine with images files.
I change files storage from database to directory "attach".
.htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule .(attach)$ /attach/1/watermark.php [QSA,NC]
watermark.php
<?php
$path = $_SERVER['DOCUMENT_ROOT'].$_SERVER['REQUEST_URI'];
$image = imagecreatefromstring(file_get_contents($path));
$w = imagesx($image);
if ($w > 50) {
$h = imagesy($image);
$watermark = imagecreatefrompng('watermark.png');
$ww = imagesx($watermark);
$wh = imagesy($watermark);
imagecopy($image, $watermark, $w-$ww, $h-$wh, 0, 0, $ww, $wh);
}
header('Content-type: image/jpeg');
imagejpeg($image);
exit();
?>
I see watermark at this address (http://www.temerar.ro/attach/1/34.attach)
But at this address (http://www.temerar.ro/content.php?112-Manhattan-Beach-California) watermark not working. WHY ? it is the same file.
Please help me with that.
Best Regards,
I have this script and works fine with images files.
I change files storage from database to directory "attach".
.htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule .(attach)$ /attach/1/watermark.php [QSA,NC]
watermark.php
<?php
$path = $_SERVER['DOCUMENT_ROOT'].$_SERVER['REQUEST_URI'];
$image = imagecreatefromstring(file_get_contents($path));
$w = imagesx($image);
if ($w > 50) {
$h = imagesy($image);
$watermark = imagecreatefrompng('watermark.png');
$ww = imagesx($watermark);
$wh = imagesy($watermark);
imagecopy($image, $watermark, $w-$ww, $h-$wh, 0, 0, $ww, $wh);
}
header('Content-type: image/jpeg');
imagejpeg($image);
exit();
?>
I see watermark at this address (http://www.temerar.ro/attach/1/34.attach)
But at this address (http://www.temerar.ro/content.php?112-Manhattan-Beach-California) watermark not working. WHY ? it is the same file.
Please help me with that.
Best Regards,