Welcome, Guest. Please login or register.
Did you miss your activation email?
May 25, 2012, 10:15:15 AM

Login with username, password and session length
Search:     Advanced search
Interested in joining the WebsiteBaker team?
For more Information read here or on our new website.
155491 Posts in 21710 Topics by 7738 Members
Latest Member: fo5azydk440me
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: auto watermark on images  (Read 4555 times)
snark
Guest
« on: April 03, 2009, 12:02:20 PM »

I found a terrific script that creates watermarked pics on the fly

what it does:

on opening an image it creates a new version of the image including the watermark

it does NOT edit the original and has the abillity to exclude files

for instance I told the htaccess file that files with relf in the filename do not have to get the watermark

in that way it works great with imageflow

how it is applied:

place the files in the attached zipfile in a dir in de media, alle the subfolders will react to the script

easy as can be

----

my question, it doesn't work with filenames that use spaces and that is something I like a lot in the imageflow

so I put in

Code:
Function Replace($image)
{

$pic = preg_replace('|[^a-zA-Z0-9_\-.]|', '-', $image);

return $pic;

}


but that does'nt do the trick

anyone?



note: you do not have to include any code into your files, just place the supplied files in de media dir
« Last Edit: June 03, 2009, 10:21:37 AM by snark » Logged
snark
Guest
« Reply #1 on: April 03, 2009, 09:07:09 PM »

for everyone who doesn't know ... the htaccess in the zipp needs a dot before the filename as soon as it iss on the server...
« Last Edit: June 03, 2009, 10:21:56 AM by snark » Logged
snark
Guest
« Reply #2 on: June 03, 2009, 10:21:09 AM »

does anyone know how to set the jpg quality for this... I want the jpg quality to be better than the huge compression it now automatically does...



Code:
<?php


$path 
$_SERVER['DOCUMENT_ROOT'].$_SERVER['REQUEST_URI'];

$image imagecreatefromstring(file_get_contents($path));



$w imagesx($image);

$h imagesy($image);



// You can change the watermark filename below.

$watermark imagecreatefrompng('watermark.png');

$ww imagesx($watermark);

$wh imagesy($watermark);



imagecopy($image$watermark$w-$ww$h-$wh00$ww$wh);



header('Content-type: image/jpeg');

imagejpeg($image);

exit();

?>
Logged
Ruud
WebsiteBaker Org e.V.

Offline Offline

Posts: 2295



WWW
« Reply #3 on: June 03, 2009, 10:38:23 AM »

The function imageJPEG has 3 parameters (last 2 optional).
The second parameter is a file to save the image (leave empty to use standard output)
The 3rd parameter is the jpg quality (1 to 100).

imagejpeg $image '' 85 ) ;
should output the image in jpg quality 85.

Ruud

Edit: http://www.php.net/imagejpeg - The default quality is 75.
« Last Edit: June 03, 2009, 10:42:52 AM by Ruud » Logged

Professional WebsiteBaker Solutions
snark
Guest
« Reply #4 on: June 03, 2009, 11:34:21 AM »

once again:

Logged
Steven

Offline Offline

Posts: 30


« Reply #5 on: November 19, 2009, 03:26:57 PM »

Hi guys,

Nice script. Works fine but I have two questions. Is it possible not to show the watermark.png itself in the gallery (I'm using Lightbox2) and secondly: I can't seem to manage not to let the watermark show on the thumbs.
This is what it says in the htaccess:
Code:
RewriteCond %{REQUEST_FILENAME} !thumb

Any ideas?


Steven
Logged
snark
Guest
« Reply #6 on: November 20, 2009, 12:38:02 AM »

place a folder inside the folder where the watermark script is..

the watermark script also works on the subfolders.. that way you can point your lightbox module to a subfolder and not show the watermark.png

/media
/fotoalbums
  /- watermark script
  /- watermark.png
  /- subfolder
    /  - picture.jpg
    /  - picture2.jpg
    /  - picture3.png


lightbox - dir : media/fotoalbums/subfolder/

voila


Logged
Steven

Offline Offline

Posts: 30


« Reply #7 on: November 20, 2009, 12:18:46 PM »

Hi Snark,


Thanxs alot!


Steven
Logged
voordeelwb

Offline Offline

Posts: 4


« Reply #8 on: January 21, 2011, 03:26:06 PM »

Thanks! Works perfect

The watermark is now in right corner is it possible to change that to middle or left?



Logged
snark
Guest
« Reply #9 on: January 27, 2011, 07:17:09 PM »

I suppose it Will not be too difficult,

Btw, this is where i found THE script

http://blog.triphp.com/www/scripts/automark.html
Logged
daydreamer

Offline Offline

Posts: 252


« Reply #10 on: October 26, 2011, 02:22:47 PM »

Did anyone get this to work with file names, could do with it for foldergallery
Thanks
Nick
Logged
Bug

Offline Offline

Posts: 188


« Reply #11 on: October 30, 2011, 06:07:58 PM »

What do you mean by 'file names'?

I recently have build this into A brax highslide gallery and that works fine
Logged
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!