Mihalism Technologies: [Untested] - Watermark mod - Mihalism Technologies

Jump to content

READ BEFORE USING MODIFICATIONS

Before the use of any modifications within this forum, please be aware of the following:

1. All modifications are provided as-is without any warranty of merchantability or warranty of fitness for a particular purpose.
2. Like any product, there is a risk of data loss or damage when used improperly or in untested environments or configurations. Accordingly,
you should use the modifications in strict accordance with its documentation and only after making a successful backup of your data.
3. Mihalism Technologies and the author of each modification does not claim any responsibility for data loss as a result of misuse.
4. Mihalism Technologies does not provide support for any modifications listed within this forum. It is the job of the authors to provide support.

This forum is not for modification requests!
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

[Untested] - Watermark mod Rate Topic: -----

#1 User is offline   Josh D. Icon

  • Staff
  • PipPipPip
  • Group: Administrators
  • Posts: 456
  • Joined: 07-February 09

Posted 30 March 2009 - 09:20 PM

Warning! This mod has not been tested, use at your own risk.

QUOTE ("samel2007")
follow these steps and you should be good to go...

Open "upload.php" and search for this -
CODE
$mmhclass->image->create_thumbnail($filename);


Should be line 53 for those following along in their hymnals...

After that line, copy and paste this into the file -

CODE
$path = "images/";
$mmhclass->image->add_watermark($extension, $path, $filename);


Save the file...

Now go into the "source\includes\" folder and open "imagemagick.php".
Goto the end of the file and go back up inside the first curly bracket ("}") and paste this into the file -

CODE
//New function to Add Watermark
        function add_watermark($extension, $path, $filename)
        {
            global $mmhclass;
            $image_upfile = $path.$filename;
        
            if($extension == "jpeg" || $extension == "jpg")
            {
                $watermark = imagecreatefrompng('css/watermark.png');
                imageAlphaBlending($watermark, false);
                imageSaveAlpha($watermark, true);
                $watermark_width = imagesx($watermark);  
                $watermark_height = imagesy($watermark);  
                $image = imagecreatetruecolor($watermark_width, $watermark_height);  
                $image = imagecreatefromjpeg($image_upfile);  
                $size = getimagesize($image_upfile);  
                $dest_x = $size[0] - $watermark_width - 5;  
                $dest_y = $size[1] - $watermark_height - 5;  
                imagecopymerge($image, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height, 100);
        
                if(@imagejpeg($image, $image_upfile, 90))
                {
                    $img_watermakred = "yes";
                }
        
                imagedestroy($image);
                imagedestroy($watermark);
            }
        
            if($extension == "png")
            {
                $watermark = imagecreatefrompng('css/watermark.png');  
                $watermark_width = imagesx($watermark);  
                $watermark_height = imagesy($watermark);  
                $image = imagecreatetruecolor($watermark_width, $watermark_height);  
                $image = imagecreatefrompng($image_upfile);  
                $size = getimagesize($image_upfile);  
                $dest_x = $size[0] - $watermark_width - 5;  
                $dest_y = $size[1] - $watermark_height - 5;  
                imagecopymerge($image, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height, 100);
        
                if(@imagepng($image, $image_upfile))
                {
                    $img_watermakred = "yes";
                }
        
                imagedestroy($image);
                imagedestroy($watermark);
            }
        
            if($extension == "gif")
            {
                $watermark = imagecreatefrompng('css/watermark.png');  
                $watermark_width = imagesx($watermark);  
                $watermark_height = imagesy($watermark);  
                $image = imagecreatetruecolor($watermark_width, $watermark_height);  
                $image = imagecreatefromgif($image_upfile);  
                $size = getimagesize($image_upfile);  
                $dest_x = $size[0] - $watermark_width - 5;  
                $dest_y = $size[1] - $watermark_height - 5;  
                imagecopymerge($image, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height, 100);  
        
                if(@imagegif($image, $image_upfile))
                {
                    $img_watermakred = "yes";
                }
        
                imagedestroy($image);
                imagedestroy($watermark);
            }
        }

Save the file...

Finally, create a png file of whatever you want your watermark to be, save it as "watermark.png" and put it in the root "css" folder. If you want to name it something different or put it somewhere else, just search in the code above for "css/watermark.png" and replace it...

Now all the new photos that are uploaded will be marked with your watermark...

all above informations is quoted from some athor forum..


Do not PM me for support (message will be ignored), please use the support forum and one of the staff members will try to assist you.

Posted Image
0

#2 User is offline   nvt10512 Icon

  • Newbie
  • Pip
  • Group: Members
  • Posts: 4
  • Joined: 30-March 09

Posted 30 March 2009 - 10:57 PM

hix, it not transparent!

0

#3 User is offline   kijairo Icon

  • Member
  • PipPip
  • Group: Members
  • Posts: 19
  • Joined: 22-April 09

Posted 12 May 2009 - 08:25 PM

Goto the end of the file and go back up inside the first curly bracket ("}") and paste this into the file -

Could you please specified the curly Bracket ("}") ???

Thanks
0

#4 User is offline   M.H Icon

  • Newbie
  • Pip
  • Group: Members
  • Posts: 3
  • Joined: 08-May 09

Posted 13 May 2009 - 04:09 AM

thanks ,
but it's not transparent ,

what about transparent watermark !?
0

#5 User is offline   Sup3R_B0Y Icon

  • Newbie
  • Pip
  • Group: Members
  • Posts: 4
  • Joined: 29-May 09

Posted 30 May 2009 - 11:24 PM

can you please define it more clearly, its not working for me
0

#6 User is offline   Josh D. Icon

  • Staff
  • PipPipPip
  • Group: Administrators
  • Posts: 456
  • Joined: 07-February 09

Posted 30 May 2009 - 11:47 PM

Wish I could help but I'm not the one who originally posted that and I've never tested it.
Do not PM me for support (message will be ignored), please use the support forum and one of the staff members will try to assist you.

Posted Image
0

#7 User is offline   Sup3R_B0Y Icon

  • Newbie
  • Pip
  • Group: Members
  • Posts: 4
  • Joined: 29-May 09

Posted 31 May 2009 - 05:21 PM

if u r have any other tested way to show watermarks on images, please share with us!
0

#8 User is offline   sasha2002 Icon

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 89
  • Joined: 08-July 09

Posted 08 July 2009 - 02:59 AM

I try to use it, YES IT WORK but with some errors like white/black background on watermark(if is transparent).

Josh you can make it like an module?
Can you enable it in admin area to i can set the setings(like position and watermark name or only text with selected font) from admin menu not from script?
If i or my post was useful just vote up post!!!
0

#9 User is offline   Josh D. Icon

  • Staff
  • PipPipPip
  • Group: Administrators
  • Posts: 456
  • Joined: 07-February 09

Posted 08 July 2009 - 03:46 AM

Sorry, I don't have any plans on making any more mods at this time as I'm still working on a couple I haven't released yet.
Do not PM me for support (message will be ignored), please use the support forum and one of the staff members will try to assist you.

Posted Image
0

#10 User is offline   HighEnergy Icon

  • Newbie
  • Pip
  • Group: Members
  • Posts: 1
  • Joined: 10-July 09

Posted 10 July 2009 - 01:56 PM

It works fine if the PNG is created correctly.
ie:
Use a colored background then after creating your watermark set the background color you used as transparent when saving your PNG.
Posted Image
0

#11 User is offline   kijairo Icon

  • Member
  • PipPip
  • Group: Members
  • Posts: 19
  • Joined: 22-April 09

Posted 18 August 2009 - 01:08 AM

Hello,
could anyone please send me the upload.php and imagemagick.php file ? can't figure out how it work :(

Thanks
0

#12 User is offline   VNDownload.Org Icon

  • Newbie
  • Pip
  • Group: Members
  • Posts: 2
  • Joined: 19-August 09

Posted 19 August 2009 - 05:29 AM

View Postkijairo, on 18 August 2009 - 08:08 AM, said:

Hello,
could anyone please send me the upload.php and imagemagick.php file ? can't figure out how it work :(

Thanks


upload.php:
Posted Image


imagemagick.php:
Posted Image

Good luck and Have fun!

Demo: http://img.vndownloa.../mmh2/index.php

This post has been edited by VNDownload.Org: 19 August 2009 - 05:32 AM

0

#13 User is offline   kijairo Icon

  • Member
  • PipPip
  • Group: Members
  • Posts: 19
  • Joined: 22-April 09

Posted 22 August 2009 - 05:12 PM

View PostVNDownload.Org, on 19 August 2009 - 01:29 AM, said:

upload.php:
Posted Image


imagemagick.php:
Posted Image

Good luck and Have fun!

Demo: http://img.vndownloa.../mmh2/index.php



Thanks a lot Bro, it finally work :D

Thanks so much :)
0

#14 User is offline   slug Icon

  • Newbie
  • Pip
  • Group: Members
  • Posts: 4
  • Joined: 07-March 10

Posted 07 March 2010 - 09:23 PM

i've gotten this to work but the watermark kills any animated gif uploaded.
anyone have a way to get this working with animated images?
0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic