Mod to adjust watermark transparency

Phoca Gallery plugins - plugins for Phoca Gallery extension
anij21
Phoca Newbie
Phoca Newbie
Posts: 3
Joined: 09 Apr 2009, 02:08

Mod to adjust watermark transparency

Post by anij21 »

This mod will allow your watermarks to be faded to a percentage 100% is the same the current way it works.
I use 15% to give a ghostly watermark.

Find: administrator/components/com_phocagallery/helpers/phocagallery.php
Find:
// Watermark
if ($fileWatermark != '') {
ImageCopy($image2,$waterImage1,$locationX,$locationY,0,0,$wW,$hW);
}
// End Watermark

Replace with:
// Watermark
if ($fileWatermark != '') {
ImageCopymerge($image2,$waterImage1,$locationX,$locationY,0,0,$wW,$hW, 15);
}
// End Watermark

The final parameter is now the percentage of the watermark picture that you see.
It should also be easy to add into the parameter list as a preset, if I get time I'll have a look on how to do it.
An1j21
anij21
Phoca Newbie
Phoca Newbie
Posts: 3
Joined: 09 Apr 2009, 02:08

Re: Mod to adjust watermark transparency

Post by anij21 »

To add a transparency setting to the parameters

Find: administrator/components/com_phocagallery/helpers/phocagallery.php
Find:

// Watermark
if ($fileWatermark != '') {
ImageCopymerge($image2,$waterImage1,$locationX,$locationY,0,0,$wW,$hW, 15);
}
// End Watermark

Replace with:
// Watermark
if ($fileWatermark != '') {
$Wtransparency = $params->get( 'Wtransparency', 15 );
ImageCopymerge($image2,$waterImage1,$locationX,$locationY,0,0,$wW,$hW, $Wtransparency);
}
// End Watermark

Find:
administrator/components/com_phocagallery/config.xml
Find:
<param name="watermark_position_y" type="list" default="middle" label="Y-Position of Watermark" description="Y-Position of Watermark DESC">
<option value="top">top</option>
<option value="middle">middle</option>
<option value="bottom">bottom</option>
</param>

Add after:
<param name="Wtransparency" type="phocatext" size="3" default="15" label="Watermark transparency" description="Watermark transparency" />

Don't forget to rebuild all the thumbnails after.
If you can ssh in then in the folder /images/phocagallery use the following command line to remove ALL thumbnails fast.
find -name "*phoca_thumb*" -print0|xargs -0 rm

Thanks Jan for a brilliant component :)
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48402
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Mod to adjust watermark transparency

Post by Jan »

Great, thank you for this improvement, Jan
If you find Phoca extensions useful, please support the project
Post Reply