SMFHacks.com
** Home Forum Index Hacks Products Login Register Search
Welcome, Guest. Please login or register.
May 22, 2012, 12:38:02 pm

Login with username, password and session length
Members
Total Members: 10066
Latest: khoeidong
Stats
Total Posts: 28682
Total Topics: 4975
Online Today: 87
Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Users: 0
Guests: 45
Total: 45
+ 
|-+ 
| |-+ 
| | |-+ 
| | | |-+ 
| | | | |-+ 
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Go Down Print
Author Topic: Watermark Font on Pro  (Read 5300 times)
lakestclair
SMF Gallery Pro Customer
Full Member
*****
Offline Offline

Posts: 103


View Profile
« on: September 06, 2007, 10:05:32 pm »

How do you edit the font size and color on Pro I just bought this version so I do bulk uploads and watermark all my pics, but the font is super small.  Not really any point to protecting.  Also tried to use a image and it won't attach it.
Logged
SMFHacks
Administrator
Hero Member
*****
Offline Offline

Posts: 9676


View Profile
« Reply #1 on: September 06, 2007, 10:24:34 pm »

No current built in setting to control the watermark font size
It is controlled by the following code in Sources/Gallery.php
Code:
  $text_height = imagefontheight(3);
  $text_width = strlen ($modSettings['gallery_set_water_text']) * imagefontwidth(3);

The water mark image path needs to be a file path
Such as /home/public_html/yourimage.png or c:/inetpub/wwwroot/yourimage.png
Logged
lakestclair
SMF Gallery Pro Customer
Full Member
*****
Offline Offline

Posts: 103


View Profile
« Reply #2 on: September 06, 2007, 10:39:45 pm »

No current built in setting to control the watermark font size
It is controlled by the following code in Sources/Gallery.php
Code:
  $text_height = imagefontheight(3);
  $text_width = strlen ($modSettings['gallery_set_water_text']) * imagefontwidth(3);

The water mark image path needs to be a file path
Such as /home/public_html/yourimage.png or c:/inetpub/wwwroot/yourimage.png

Where do I find the code or do I have to enter the code.  I'm new to writing code so bear with me when I ask stupid questions.  If I have to add it where do I add it?
Logged
SMFHacks
Administrator
Hero Member
*****
Offline Offline

Posts: 9676


View Profile
« Reply #3 on: September 06, 2007, 10:58:24 pm »

The main gallery source file is found at Sources/Gallery.php inside your forum and this file can be downloaded to the computer and opened in a text editor such as notepad to edit.


The font size for the built image fonts range from 1 to 5.
The default font size is set to 3.
The higher the number the bigger the font (up to five).


Parts of the file to edit
Under the DoWaterMark function

Around line 4763
Code:
  $text_height = imagefontheight(3);
  $text_width = strlen ($modSettings['gallery_set_water_text']) * imagefontwidth(3);
The 3 in both of those lines is the font size which can be from 1 to 5


Around line 4778
Code:
// Write the text on the picuture
  imagestring($image, 3, $xpos, $ypos, $modSettings['gallery_set_water_text'], $text_color);
The 3 in that function controls the image size and can be from 1 to 5


Going to be looking at using a different text watermarking system for Gallery Pro 1.3 seems you can use the imagettftext function to set the size of the text with pixels using truetype fonts.
Logged
lakestclair
SMF Gallery Pro Customer
Full Member
*****
Offline Offline

Posts: 103


View Profile
« Reply #4 on: September 06, 2007, 11:19:45 pm »

Well I'm having trouble finding the code to edit it, but once I do and edit it in notepad how do I incorporate it into your code for the font to take place?

Again excuse my ignorance as I'm new to code writing.
Logged
SMFHacks
Administrator
Hero Member
*****
Offline Offline

Posts: 9676


View Profile
« Reply #5 on: September 06, 2007, 11:29:37 pm »

A quick way would be to use the find function in the text editor to find the piece code. After you have the file edited you would just upload Gallery.php back to the Sources folder on your website and the size settings will take affect for all newly uploaded images.
Logged
lakestclair
SMF Gallery Pro Customer
Full Member
*****
Offline Offline

Posts: 103


View Profile
« Reply #6 on: September 06, 2007, 11:38:24 pm »

A quick way would be to use the find function in the text editor to find the piece code. After you have the file edited you would just upload Gallery.php back to the Sources folder on your website and the size settings will take affect for all newly uploaded images.

Changed it to (5), but still is small font.  I guess I don't know what I'm doing here?
« Last Edit: September 06, 2007, 11:44:19 pm by lakestclair » Logged
lakestclair
SMF Gallery Pro Customer
Full Member
*****
Offline Offline

Posts: 103


View Profile
« Reply #7 on: September 06, 2007, 11:53:13 pm »

Here's what it looks like in code, but still won't enlarge it on the pictures.

Quote

  // Draw Text on the image
  if ($modSettings['gallery_set_water_text'] != '')
  {
     
      $xpos = 5;
      $ypos = 5;
     
    $color = eregi_replace("#","", $modSettings['gallery_set_water_textcolor']);
    
    // Split the colors up into RGB
      $text_color = imagecolorallocate ($image, hexdec(substr($color,0,2)), hexdec(substr($color,2,2)), hexdec(substr($color,4,2)));

     $text_height = imagefontheight(5);
     $text_width = strlen ($modSettings['gallery_set_water_text']) * imagefontwidth(5);

    
    if ($modSettings['gallery_set_water_valign'] == 'bottom')
      $ypos = $image_height - $text_height - 5;
    elseif ($modSettings['gallery_set_water_valign'] == 'center')
      $ypos = (int)($image_height / 2 - $text_height / 5);


    if ($modSettings['gallery_set_water_halign'] == 'right')
      $xpos = $image_width - $text_width - 2;
    elseif ($modSettings['gallery_set_water_halign'] == 'center')
      $xpos = (int)($image_width / 2- $text_width / 2);

   // Write the text on the picuture
     imagestring($image, 3, $xpos, $ypos, $modSettings['gallery_set_water_text'], $text_color);

 
Logged
SMFHacks
Administrator
Hero Member
*****
Offline Offline

Posts: 9676


View Profile
« Reply #8 on: September 07, 2007, 07:16:17 am »

One more todo
Code:
   // Write the text on the picuture
     imagestring($image, 3, $xpos, $ypos, $modSettings['gallery_set_water_text'], $text_color);
Change the 3 to a five
Logged
lakestclair
SMF Gallery Pro Customer
Full Member
*****
Offline Offline

Posts: 103


View Profile
« Reply #9 on: September 08, 2007, 06:13:48 pm »

Thanks.  I got the font fixed, but would like to implement a image as a watermark.  This is how I have it written, but for some reason it won't implement it into the picture when it posts.

Quote
/home/public_html/lakestclair.PNG
Logged
SMFHacks
Administrator
Hero Member
*****
Offline Offline

Posts: 9676


View Profile
« Reply #10 on: September 09, 2007, 09:33:23 pm »

That appears correct from first glance and should work if watermarking is enabled. Anything in your forum's error log?
Logged
lakestclair
SMF Gallery Pro Customer
Full Member
*****
Offline Offline

Posts: 103


View Profile
« Reply #11 on: September 10, 2007, 03:59:49 pm »

No errors affiliated to the gallery other than pics that have been deleted. Huh
Logged
SMFHacks
Administrator
Hero Member
*****
Offline Offline

Posts: 9676


View Profile
« Reply #12 on: September 11, 2007, 07:40:54 am »

If you go to Admin -> Server Settings
Under SMF Directory copy that path and then add the the image filename to that path if the image is located in the forum's path.
Logged
lakestclair
SMF Gallery Pro Customer
Full Member
*****
Offline Offline

Posts: 103


View Profile
« Reply #13 on: September 14, 2007, 06:36:13 pm »

If you go to Admin -> Server Settings
Under SMF Directory copy that path and then add the the image filename to that path if the image is located in the forum's path.

Nope that didn't correct it either.  I'll get the path of the file maybe that will help to diagnose
Logged
Pages: [1] Go Up Print 
« previous next »
Jump to:  

Recent
[May 21, 2012, 08:54:11 am]

[May 20, 2012, 11:06:52 am]

[May 20, 2012, 05:58:11 am]

[May 19, 2012, 06:16:58 pm]

[May 19, 2012, 05:42:37 pm]

[May 18, 2012, 03:08:38 pm]

[May 17, 2012, 06:07:46 pm]

[May 17, 2012, 02:22:07 pm]

[May 17, 2012, 12:38:16 pm]

[May 15, 2012, 09:32:27 pm]
Random Picture
Donate to SMFHacks.com
Help Support the SMFHacks.com mod making.
Powered by SMF 1.1.16 | SMF © 2006-2011, Simple Machines LLC
TinyPortal v0.9.7 © Bloc
SMF and SimpleMachines are registered trademarks of Simple Machines. SMFHacks.com is not affiliated with nor endorsed by Simple Machines.
Page created in 0.268 seconds with 20 queries.