1
skelink
Watermark with myalbum
  • 2008/1/29 10:43

  • skelink

  • Just popping in

  • Posts: 9

  • Since: 2007/8/26


How i can use watermark with my album, they are an Hack for watermarks?

thanks

skelink

2
Trier
Re: Watermark with myalbum
  • 2008/1/29 11:26

  • Trier

  • Friend of XOOPS

  • Posts: 12

  • Since: 2007/3/18



3
Feichtl
Re: Watermark with myalbum
  • 2008/1/29 13:56

  • Feichtl

  • Not too shy to talk

  • Posts: 126

  • Since: 2004/11/8


I'm looking for this hack also. The linked website above is unreadable for non-russians. Only code ist useful, but explanations could be helpful too.

4
Trier
Re: Watermark with myalbum
  • 2008/1/29 15:22

  • Trier

  • Friend of XOOPS

  • Posts: 12

  • Since: 2007/3/18


Sorry, I do not speak English. I use: http://translate.google.com/translate_t?langpair=ru|en.
In folder root/uploads/photos create a file modify.php and file .HTACCESS and figure wt.png.


modify.php:
// IMAGE WATERMARK(to close the following line with the non-image)
Define('WATERMARK_IMAGE', './wt.png'); //path to the image watermark (no change)
Define('WATERMARK_PERCENT', '60'); //Transparency figure (%%)


// TEXT WATERMARK (to close the following line with the non-text)
Define('WATERMARK_TEXT', 'Copyright (c) 2008 .............'); //Enter your text (if an image will not be used)
Define('WATERMARK_TEXT_FONT', '3'); // font 1 / 2 / 3 / 4 / 5
Define('TEXT_SHADOW', '1'); // 1 - yes / 0 - no
Define('TEXT_COLOR', '#FFFFFF'); // text color


// GENERAL SETTINGS (Location text, pictures)
Define('WATERMARK_ALIGN_H', 'right'); // left / right / center
Define('WATERMARK_ALIGN_V', 'bottom'); // top / bottom / center
Define('WATERMARK_MARGIN', '10'); // margin

// ----------------------------------------------------------------------------------------

$dr=preg_replace('/modify\.php.+/', '', $_SERVER['PHP_SELF']);
$filename=str_replace($dr, './', $_SERVER['PATH_INFO']);

$lst=GetImageSize($filename);
$image_width=$lst[0];
$image_height=$lst[1];
$image_format=$lst[2];

if ($image_format==1) {
Header("Content-Type:image/gif");
readfile($filename);
exit;
} elseif ($image_format==2) {
$old_image=imagecreatefromjpeg($filename);
} elseif ($image_format==3) {
$old_image=imagecreatefrompng($filename);
} else {
readfile($filename);
exit;
}


if (Defined('WATERMARK_TEXT') && WATERMARK_TEXT!='') {
// text

$color = eregi_replace("#","", TEXT_COLOR);
$red = hexdec(substr($color,0,2));
$green = hexdec(substr($color,2,2));
$blue = hexdec(substr($color,4,2));

$text_color = imagecolorallocate ($old_image, $red, $green, $blue);

$text_height=imagefontheight(WATERMARK_TEXT_FONT);
$text_width=strlen(WATERMARK_TEXT)*imagefontwidth(WATERMARK_TEXT_FONT);
$wt_y=WATERMARK_MARGIN;
if (WATERMARK_ALIGN_V=='top') {
$wt_y=WATERMARK_MARGIN;
} elseif (WATERMARK_ALIGN_V=='bottom') {
$wt_y=$image_height-$text_height-WATERMARK_MARGIN;
} elseif (WATERMARK_ALIGN_V=='center') {
$wt_y=(int)($image_height/2-$text_height/2);
}

$wt_x=WATERMARK_MARGIN;
if (WATERMARK_ALIGN_H=='left') {
$wt_x=WATERMARK_MARGIN;
} elseif (WATERMARK_ALIGN_H=='right') {
$wt_x=$image_width-$text_width-WATERMARK_MARGIN;
} elseif (WATERMARK_ALIGN_H=='center') {
$wt_x=(int)($image_width/2-$text_width/2);
}

if (TEXT_SHADOW=='1') {
imagestring($old_image, WATERMARK_TEXT_FONT, $wt_x+1, $wt_y+1, WATERMARK_TEXT, 0);
}
imagestring($old_image, WATERMARK_TEXT_FONT, $wt_x, $wt_y, WATERMARK_TEXT, $text_color);

}

if (Defined('WATERMARK_IMAGE') && WATERMARK_IMAGE!='' && file_exists(WATERMARK_IMAGE)) {
// image


$lst2=GetImageSize(WATERMARK_IMAGE);
$image2_width=$lst2[0];
$image2_height=$lst2[1];
$image2_format=$lst2[2];

if ($image2_format==2) {
$wt_image=imagecreatefromjpeg(WATERMARK_IMAGE);
} elseif ($image2_format==3) {
$wt_image=imagecreatefrompng(WATERMARK_IMAGE);
}

if ($wt_image) {

$wt_y=WATERMARK_MARGIN;
if (WATERMARK_ALIGN_V=='top') {
$wt_y=WATERMARK_MARGIN;
} elseif (WATERMARK_ALIGN_V=='bottom') {
$wt_y=$image_height-$image2_height-WATERMARK_MARGIN;
} elseif (WATERMARK_ALIGN_V=='center') {
$wt_y=(int)($image_height/2-$image2_height/2);
}

$wt_x=WATERMARK_MARGIN;
if (WATERMARK_ALIGN_H=='left') {
$wt_x=WATERMARK_MARGIN;
} elseif (WATERMARK_ALIGN_H=='right') {
$wt_x=$image_width-$image2_width-WATERMARK_MARGIN;
} elseif (WATERMARK_ALIGN_H=='center') {
$wt_x=(int)($image_width/2-$image2_width/2);
}

imagecopymerge($old_image, $wt_image, $wt_x, $wt_y, 0, 0, $image2_width, $image2_height, WATERMARK_PERCENT);
}

}

if ($image_format==2) {
imageJpeg($old_image);
}
if ($image_format==3) {
imagePng($old_image);
}
?>

.HTACCESS:
addhandler wtmrk jpg
action wtmrk 
/uploads/photos/modify.php


wt.png -Your watermark.

5
Single
Re: Watermark with myalbum
  • 2008/2/8 13:14

  • Single

  • Just popping in

  • Posts: 13

  • Since: 2008/2/8 1


sorry but the hack dosent work by me.

6
Feichtl
Re: Watermark with myalbum
  • 2008/2/8 18:13

  • Feichtl

  • Not too shy to talk

  • Posts: 126

  • Since: 2004/11/8


Doesn't work for me too. Maybe because i use myalbum-p with lightbox hack? I only get an endless loading animation and no picture.

7
BlueStocking
Re: Watermark with myalbum

hhttps://xoops.org/modules/repository .. It is time to get involved - XOOPS.ORG

8
Shine
Re: Watermark with myalbum
  • 2008/2/9 8:52

  • Shine

  • Just can't stay away

  • Posts: 822

  • Since: 2002/7/22


Quote:
MyAlbum * Talk:MyAlbum

??
Are you gonna add every discussion considering a module within the wiki with a link to this forum?

Sorry to say and dispite all your effords....but I find this wiki very user unfriendly. I get totally lost. If I am within: https://xoops.org/modules/mediawiki/index.php/MyAlbum, I haven't the slidest idea where I am and how I get into the main categorie where this item has been placed or belongs.
The -menu-structure isn't clear at all.
Second: All I see are created pages which are in fact empty.

9
Feichtl
Re: Watermark with myalbum
  • 2008/2/9 16:05

  • Feichtl

  • Not too shy to talk

  • Posts: 126

  • Since: 2004/11/8


Quote:
All I see are created pages which are in fact empty

Take it as a starting point to fill the wiki with information. Not only one, each of us should contribute And why not put links to threads, which may bring the wanted solution?

10
Peekay
Re: Watermark with myalbum
  • 2008/2/9 17:36

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


I have to confess that I too am getting weary of seeing links to the wiki that don't provide a solution for the thread starter.

I highly recommend that XOOPS users search the wiki, but I agree with Shine that it should NOT be gratuitously promoted in the forums in response to a specific question unless the link leads to a specific answer.
A thread is for life. Not just for Christmas.

Login

Who's Online

340 user(s) are online (263 user(s) are browsing Support Forums)


Members: 0


Guests: 340


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits