Post by tompeterson » Thu Apr 09, 2009 2:52 pm

Hello

I want to add to my images watermark when picture is enlarged how can I do this?

can help somebody?

Newbie

Posts

Joined
Thu Apr 09, 2009 2:48 pm

Post by mal-schauen » Sat Apr 11, 2009 12:20 am

1. either DIV Overlay
2. or advance bring it manually on the images

Alles für die Anwendung im deutschen Sprachraum
Hier gehts zum deutschen Forumbereich


User avatar
Moderator

Posts

Joined
Sun Feb 08, 2009 11:16 pm
Location - Germany

Post by tompeterson » Tue Apr 14, 2009 3:28 pm

But I need watermark only in picture enlarged..in popup...is it possible to create watermark by php function..and how? thanks

Newbie

Posts

Joined
Thu Apr 09, 2009 2:48 pm

User avatar
Global Moderator

Posts

Joined
Thu Mar 05, 2009 11:15 pm
Location - Phoenix, AZ

Post by tompeterson » Mon May 18, 2009 8:22 pm

can somebody help with script for watermarking and its adding to opencart?

Newbie

Posts

Joined
Thu Apr 09, 2009 2:48 pm

Post by Daniel » Mon May 18, 2009 8:29 pm

watermarking is already built into the image class.

User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by tompeterson » Mon May 18, 2009 8:56 pm

Yes I find it but i don' t know how to use it

Newbie

Posts

Joined
Thu Apr 09, 2009 2:48 pm

Post by Daniel » Mon May 18, 2009 9:45 pm

$image = new Image('my_image.jpg'):
$image->watermark('watermark_image.png', 'bottomright');

You might want to use transparent png's for the watermark for the best effect.

User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by tompeterson » Mon May 18, 2009 9:54 pm

thanks very much

Newbie

Posts

Joined
Thu Apr 09, 2009 2:48 pm

Post by tompeterson » Tue May 19, 2009 2:42 pm

i 've added this line of code
$image->watermark('watermark.png', 'bottomright');
to image.php in system / helper
but it doesn't work...

Newbie

Posts

Joined
Thu Apr 09, 2009 2:48 pm

Post by Daniel » Tue May 19, 2009 6:14 pm

did you add the exact location of the watemark image?

$image->watermark(DIR_IMAGE . 'watermark.png', 'bottomright');

Did you create a watermark image and put it in the right place?

User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by tompeterson » Tue May 19, 2009 6:19 pm

yes watermark image is in the image folder and I try also add exact location of watermark image

Newbie

Posts

Joined
Thu Apr 09, 2009 2:48 pm

Post by tompeterson » Tue May 19, 2009 8:56 pm

this is error statement that i've got...images are in jpg format

Warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: gd-jpeg: JPEG library reports unrecoverable error: in /domains1/do1231500/public/www_root/vmshop/system/library/image.php on line 34

Warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: '/domains1/do1231500/public/www_root/vmshop/image/watermark.png' is not a valid JPEG file in /system/library/image.php on line 34

Warning: imagesx(): supplied argument is not a valid Image resource in /system/library/image.php on line 88

Warning: imagesy(): supplied argument is not a valid Image resource in /system/library/image.php on line 89

Warning: imagecopy(): supplied argument is not a valid Image resource in /system/library/image.php on line 110

Warning: imagedestroy(): supplied argument is not a valid Image resource in /system/library/image.php on line 112

Newbie

Posts

Joined
Thu Apr 09, 2009 2:48 pm

Post by acidline » Thu Jun 18, 2009 12:33 am

Hello,

You must modify the watermark method ...

Code: Select all

   public function watermark($file, $position = 'bottomright') {
	
	//Pb ! you don't work on the true object => you must modify the "create" method ($mime = $this->info['mime']; it's work only if we have the same image format !
        //$watermark = $this->create($file);

        //Prefer PNG files => it's not optimized but it's work
	$watermark = imagecreatefrompng($file);
        
        $watermark_width  = imagesx($watermark);
        $watermark_height = imagesy($watermark);

        switch($position) {
            case 'topleft':
                $watermark_pos_x = 0;
                $watermark_pos_y = 0;
                break;
            case 'topright':
                $watermark_pos_x = $this->info['width'] - $watermark_width;
                $watermark_pos_y = 0;
                break;
            case 'bottomleft':
                $watermark_pos_x = 0;
                $watermark_pos_y = $this->info['height'] - $watermark_height;
                break;
            case 'bottomright':
                $watermark_pos_x = $this->info['width'] - $watermark_width;
                $watermark_pos_y = $this->info['height'] - $watermark_height;
                break;
        }
       
        imagecopy($this->image, $watermark, $watermark_pos_x, $watermark_pos_y, 0, 0, $watermark_width, $watermark_height);
        
        imagedestroy($watermark);
    }
In your helper you can use this solution like this :

Code: Select all

$image = new Image(DIR_IMAGE . $old_image);
$image->resize($width, $height);
$image->watermark(HTTP_IMAGE . 'watermark.png', 'bottomright');
$image->save(DIR_IMAGE . $new_image);	
Nico :D

Newbie

Posts

Joined
Fri Aug 01, 2008 8:16 pm

Post by itrends » Wed Jul 15, 2009 5:23 am

Hi.

I have this working, however I was wondering if it is possible to make the watermark match the size of the image it is being put over the top of? Essentially

LARGE WATERMARK
placed over
LARGE IMAGE
then
RESIZED to the size needed


anyone that can help? I have the watermark part working fine its just the image is being resized smaller while the watermark remains full size over the top and covers half the image :)

Thanks!

Active Member

Posts

Joined
Tue Jul 14, 2009 7:54 pm

Post by itrends » Wed Jul 15, 2009 5:26 am

Also, is it possible to center it instead of using a corner?

Active Member

Posts

Joined
Tue Jul 14, 2009 7:54 pm

Post by itrends » Wed Jul 15, 2009 5:32 am

HA! I sorted both problems in 10 seconds!

For those that want to know

I changed the order from

$image = new Image(DIR_IMAGE . $old_image);
$image->resize($width, $height);
$image->watermark(HTTP_IMAGE . 'overlay.png', 'bottomright');


to


$image = new Image(DIR_IMAGE . $old_image);
$image->watermark(HTTP_IMAGE . 'overlay.png', 'bottomright');
$image->resize($width, $height);



simples :)

Active Member

Posts

Joined
Tue Jul 14, 2009 7:54 pm

Post by idoso » Wed Oct 28, 2009 6:50 am

You will get problem with " $image->watermark(HTTP_IMAGE . 'overlay.png', 'bottomright'); "
if your shared server has disabled URL access which most of them does for security reason.
use DIR_IMAGE instead of HTTP_IMAGE.

Newbie

Posts

Joined
Wed Mar 04, 2009 7:27 am

Post by ThePath » Tue Nov 03, 2009 9:54 pm

Ive just tested this out and it works but the watermark is very small. How does one make it bigger?

Cheers

Image

OpenCart Theme Options - See All My Extensions - OpenCart Themes and Mods


User avatar
Active Member

Posts

Joined
Fri Jun 26, 2009 11:53 pm
Location - Scotland

Post by Qphoria » Tue Nov 03, 2009 10:13 pm

itrends wrote:HA! I sorted both problems in 10 seconds!

For those that want to know

I changed the order from

$image = new Image(DIR_IMAGE . $old_image);
$image->resize($width, $height);
$image->watermark(HTTP_IMAGE . 'overlay.png', 'bottomright');


to


$image = new Image(DIR_IMAGE . $old_image);
$image->watermark(HTTP_IMAGE . 'overlay.png', 'bottomright');
$image->resize($width, $height);



simples :)
I would think the first thing to "center" my watermark would be to remove "bottomright" from the parameter and replace it with something like "center"

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am
Who is online

Users browsing this forum: No registered users and 10 guests