PDA

View Full Version : Image Manager Branding Option


voidet
12-21-2005, 01:45 PM
Hey Everyone!

Well i wanted something that automatically adds a watermark to my images for my site articles.
The image manager is amazingly weak, but was used to add this feature. What it does:

Demo @ www.nightgen.com

1. Adds a link under delete image called "Brand Image"
2. Confirms if you would like to brand the image
3. Once confirmed it will firstly thumbnail the image to a prescribed width/height.
4. Then it will add a random water mark, i added a set of 10, which will be randomly place on my images.
5. Then it will determine hwo to place the text on the page, aligned to bottom right.
6. Then it will add text to the bottom right corner based on the file name, minus the extension and truncated if need be, based on words, not characters. The text has a shadow of black.
7. Once that is done it will rename the old file name to "filename"old.jpg and the new one will have the old name :)
8. You can choose what font you want to use :) i use Arial

But warning, all of this was hardcoded for my site,
I didnt intend to release this as a mod, so you will have to sift through the code and find what does what.

Basically all you will need to do is determine what size you want to be thumbnailed (max width or height) this can be changed in imagemanager.php. Build your watermark PNGs. Then go into THumbnail.class.php and select your font, the cut off for the trunacting and then the full path to the font file.

If i have forgot to add something sorry,
But i really don't have a heap of time to rewrite the code for user friendlyness, as i said i only made the mod for the purpose of my site.

Next mod i wanna make is an image rename in the image manager, wont be too hard!!

Have fun :D:D

[attachmentid=225]

indiqo
12-21-2005, 01:48 PM
Very nice, thank you for sharing it! :D

mirage459897
12-21-2005, 02:29 PM
thanx

abcohen
12-21-2005, 03:23 PM
nice work indeed

72dpi
12-21-2005, 11:49 PM
mate,
That is EXACTLY what I need!
I am running Subdreamer, phpbb & 4Images for student photographers. I was just asked yesterday whether they could have the option of watermarking. I'll see if I can mod 4Images with your code when they upload.

Awesome stuff!

Terminator1138
12-22-2005, 09:52 PM
looks good, perhaps someone here can write a readme file on installing and customizing...nice work

:)

spib
12-22-2005, 10:47 PM
Excellent work. I'm sure many folks will find this useful

voidet
12-23-2005, 12:34 AM
Ok ok,

1. First of all Upload and overwrite your imagemanager.php file in the admin folder
2. Search for /admin/imageprocess/nightgenwm and replace with the path and prefix to your watermark png files. They should be named something1.png, something2.png
3. search $randnum = rand(1,10); and replace 10 with the amount of png water marks u want used randomly, if you dont want it random, set 10 to 1, easy.
4. Set the size and width through editing

$thumb->size_width(100);
$thumb->size_height(100);
$thumb->size_auto(100);
$thumb->size(100,100);

you can infact erase all but $thumb->size_auto(100);, which constrain both width and height to the max number. I included all just for the option.

5. Here is where you choose your text alignment, dont change $ngtext;
$thumb->txt_watermark=$ngtext;
$thumb->txt_watermark_color='FFFFFF';
$thumb->txt_watermark_font=1;
$thumb->txt_watermark_Valing='BOTTOM';
$thumb->txt_watermark_Haling='RIGHT';
$thumb->txt_watermark_Hmargin=0;
$thumb->txt_watermark_Vmargin=0;

There is much room for tweaking in this file, so go ahead. By the way you dont need test.php, i shouldnt of included it.

ok now go into the imageprocess folder and open up Thumbnail.class.php

1. Search for imageprocess/arial.ttf and replace the entire string with the full path to the font file you are using.

2. Two lines below is the size of the font in pixels. Edit it if you want.

3. find function truncate_string($text, $length = 18) and change 18 to the amount of characters you want to cut off from the text. It wont chop a word up in the middle, only segments after or before words. chnge here also $text = truncate_string($text, 18);

4. $x = 97 - $textWidth; $y = 97; This part is Horizontal (x) and Vertical space(y). Add how many pixels spacing you want.

Sorry about the lack of support, i am on holidays, i want to help, but i also want to enjoy :)
If you have any question i can help out, just not enough time for a massive support file sorry, i hope you understand :D

Squeegie
01-30-2006, 03:46 AM
im getting this problem


Warning: imagettfbbox(): Could not find/open font in /homepages/11/d92852553/htdocs/site/admin/imageprocess/Thumbnail.class.php on line 391

Warning: imagettftext(): Could not find/open font in /homepages/11/d92852553/htdocs/site/admin/imageprocess/Thumbnail.class.php on line 395

Warning: imagettftext(): Could not find/open font in /homepages/11/d92852553/htdocs/site/admin/imageprocess/Thumbnail.class.php on line 396

Warning: imagettftext(): Could not find/open font in /homepages/11/d92852553/htdocs/site/admin/imageprocess/Thumbnail.class.php on line 397

Warning: imagettftext(): Could not find/open font in /homepages/11/d92852553/htdocs/site/admin/imageprocess/Thumbnail.class.php on line 398

Warning: imagettftext(): Could not find/open font in /homepages/11/d92852553/htdocs/site/admin/imageprocess/Thumbnail.class.php on line 399


what do i do???

72dpi
01-30-2006, 06:12 AM
Search for imageprocess/arial.ttf and replace the entire string with the full path to the font file you are using. [/b]

Your error is talking about this. Choose your font as he suggests, upload it to the directory, as suggested. that should fix your error.

voidet
01-30-2006, 07:41 AM
Yeah the path to your font is wrong!

Squeegie
03-21-2006, 09:18 PM
can you just make all the files work if i cvopy and paste them into certain directories, like already configged. Then if people want to change it let them

abcohen
12-23-2006, 07:00 PM
Please note this is kind of out of date... and the image gallery in 2.4.x is not the same... :) but I still think this was something we really needed.

MetalRush
04-17-2007, 09:32 PM
Ok, noted... but I still am very interested in the 'watermarking' of pics in my gallery.
Is there a final solution for this yet? (sorry if this sounds a little blunt... NOFI in any way tho :))

kboy_16
04-20-2007, 08:40 PM
looks there's not yet.. you'll have to wait..