Watermarking
Posted: Sat Apr 12, 2008 9:37 pm
Downloaded Serendipity for the first time today and have to say it's a great piece of work. Thanks guys. I've dabbled with other similar blogging software but this suits my requirements much better. Having said that the only thing I found missing was the ability to add watermarks to images and this has been discussed a number of times throughout the forum. Based on garvinhicking's posting I thought I'd follow up his idea and have a tinker with modifying the code directly to accommodate watermarks.
The result I've posted below. It is very dirty code and obviously cannot be directly incorporated as it is but it might help others who require this functionallity or those who might be interested in developing it.
ImageMagick convert has to be enabled and for simplicity the watermark PNG is the same dimensions as any images to be uploaded.
In the file include/functions_images.inc.php at line 663 (Serendipity 1.3), for uploaded images, I've replaced
with
Seems to do the trick.
The result I've posted below. It is very dirty code and obviously cannot be directly incorporated as it is but it might help others who require this functionallity or those who might be interested in developing it.
ImageMagick convert has to be enabled and for simplicity the watermark PNG is the same dimensions as any images to be uploaded.
In the file include/functions_images.inc.php at line 663 (Serendipity 1.3), for uploaded images, I've replaced
Code: Select all
$cmd = escapeshellcmd($serendipity['convert']) . ' -antialias -resize '. serendipity_escapeshellarg($newSize) .' '. serendipity_escapeshellarg($infile) .' '. serendipity_escapeshellarg($outfile);Code: Select all
$cmd = escapeshellcmd('/usr/bin/composite /path/to/watermark/image/watermark.png ') . serendipity_escapeshellarg($infile) . ' miff:- | ' . escapeshellcmd($serendipity['convert']) . ' - -antialias -resize '. serendipity_escapeshellarg($newSize) .' '. serendipity_escapeshellarg($outfile);