WebsiteBaker Logo
  • *
  • Templates
  • Help
  • Add-ons
  • Download
  • Home
*
Welcome, Guest. Please login or register.

Login with username, password and session length
 

News


WebsiteBaker 2.13.8 is now available!


R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WB
https://forum.websitebaker.org/index.php/topic,32355.0.html


* Support WebsiteBaker

Your donations will help to:

  • Pay for our dedicated server
  • Pay for domain registration
  • and much more!

You can donate by clicking on the button below.


  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Droplets & Snippets »
  • auto watermark on images
  • Print
Pages: [1]   Go Down

Author Topic: auto watermark on images  (Read 19471 times)

snark

  • Guest
auto watermark on images
« on: April 03, 2009, 01: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: [Select]
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


[gelöscht durch Administrator]
« Last Edit: June 03, 2009, 11:21:37 AM by snark »
Logged

snark

  • Guest
auto watermark on images
« Reply #1 on: April 03, 2009, 10: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, 11:21:56 AM by snark »
Logged

snark

  • Guest
Re: auto watermark on images
« Reply #2 on: June 03, 2009, 11: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: [Select]
<?php


$path 
= $_SERVER[&#39;DOCUMENT_ROOT&#39;].$_SERVER[&#39;REQUEST_URI&#39;];

$image = imagecreatefromstring(file_get_contents($path));



$w = imagesx($image);

$h = imagesy($image);



// You can change the watermark filename below.

$watermark = imagecreatefrompng(&#39;watermark.png&#39;);

$ww = imagesx($watermark);

$wh = imagesy($watermark);



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



header(&#39;Content-type: image/jpeg&#39;);

imagejpeg($image);

exit();

?>
Logged

Offline Ruud

  • Posts: 3671
  • Gender: Male
  • Do not use PM for help! Please use the forum!
    • Dev4Me - Professional WebsiteBaker Development
Re: auto watermark on images
« Reply #3 on: June 03, 2009, 11: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 , &#39;&#39; , 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, 11:42:52 AM by Ruud »
Logged
Dev4me - WebsiteBaker modules - WBhelp.org

snark

  • Guest
Re: auto watermark on images
« Reply #4 on: June 03, 2009, 12:34:21 PM »
once again:

Logged

Offline Steven

  • Posts: 68
  • Gender: Male
Re: auto watermark on images
« 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: [Select]
RewriteCond %{REQUEST_FILENAME} !thumb
Any ideas?


Steven
Logged

snark

  • Guest
Re: auto watermark on images
« 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

Offline Steven

  • Posts: 68
  • Gender: Male
Re: auto watermark on images
« Reply #7 on: November 20, 2009, 12:18:46 PM »
Hi Snark,


Thanxs alot!


Steven
Logged

Offline voordeelwb

  • Posts: 4
Re: auto watermark on images
« 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
Re: auto watermark on images
« 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

  • Guest
Re: auto watermark on images
« Reply #10 on: October 26, 2011, 03:22:47 PM »
Did anyone get this to work with file names, could do with it for foldergallery
Thanks
Nick
Logged

Offline Bug

  • Posts: 237
Re: auto watermark on images
« 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

  • Print
Pages: [1]   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Droplets & Snippets »
  • auto watermark on images
 

  • SMF 2.0.19 | SMF © 2017, Simple Machines
  • XHTML
  • RSS
  • WAP2