User avatar
Active Member

Posts

Joined
Fri Nov 27, 2009 3:40 pm
Location - Bangkok - Thailand

Post by Melanie » Wed Jul 07, 2010 8:05 am

Any news on this?

I am interested in this as well.

thanks,
Melanie

New member

Posts

Joined
Tue Mar 30, 2010 9:39 am

Post by JAY6390 » Wed Jul 07, 2010 10:11 am

Well if you want it to be on every resized image, you'll need to just add it to the file

Code: Select all

/catalog/model/tool/image.php file
find this line

Code: Select all

$image = new Image(DIR_IMAGE . $old_image); 
and put it after that if you want the watermark put on before the image gets resized, or after

Code: Select all

$image->resize($width, $height); 
something like

Code: Select all

$image->watermark(DIR_IMAGE . 'path/to/image/in/image/folder.png', 'position-name-here'); 
replacing the position-name-here with either
- topleft
- topright
- bottomleft
- bottomright

Note this has not been tested, but should work

ImageImageImage

SEO MEGA KIT PLUS - Get your site ranking higher in the search engines
Better Product SEO URL's - Perfectly structured product links
SEO URL's Route Editor PRO - Make ANY url on your site have clean keywords - even third party extensions (remove index.php)


Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by Melanie » Wed Jul 07, 2010 11:18 am

Hi,

I tried the above but it didn't work. :-[

Im running v.1.48b

Any instructions for enabling the watermark feature?

Thanks,
Melanie

New member

Posts

Joined
Tue Mar 30, 2010 9:39 am

Post by amdev » Wed Jul 07, 2010 12:59 pm

Melanie wrote:Hi,

I tried the above but it didn't work. :-[

Im running v.1.48b

Any instructions for enabling the watermark feature?

Thanks,
Melanie
Me too, it didn't work.
this my code

Code: Select all

                        $image = new Image(DIR_IMAGE . $old_image);
			$image->resize($width, $height);
			$image->watermark(DIR_IMAGE . 'data/watermark.png', 'topleft'); 
			$image->save(DIR_IMAGE . $new_image);
                        
Have any instruction???

Thanks.

ร้านค้าออนไลน์
OpenCart Thailand Support Forum
How to Upgrade oc1.5 to 2.0.1.1
Upgrading OpenCart From v.1.4 or v.1.5 to V.2.2 Step by step


User avatar
Active Member

Posts

Joined
Fri Nov 27, 2009 3:40 pm
Location - Bangkok - Thailand

Post by JAY6390 » Wed Jul 07, 2010 6:47 pm

Seems there was an error in the watermark code
Edit the file

Code: Select all

/system/library/image.php
find this line

Code: Select all

imagecopy($this->image, $watermark, $watermark_pos_x, $watermark_pos_y, 0, 0, 120, 40); 
replace with this line

Code: Select all

imagecopy($this->image, $watermark, $watermark_pos_x, $watermark_pos_y, 0, 0, $watermark_width, $watermark_height); 
Note you will need to delete all of your images located in

Code: Select all

/image/cache/data/
to get the images recreated for your cache

ImageImageImage

SEO MEGA KIT PLUS - Get your site ranking higher in the search engines
Better Product SEO URL's - Perfectly structured product links
SEO URL's Route Editor PRO - Make ANY url on your site have clean keywords - even third party extensions (remove index.php)


Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by amdev » Thu Jul 08, 2010 1:49 pm

JAY6390 wrote:Seems there was an error in the watermark code
Edit the file

Code: Select all

/system/library/image.php
find this line

Code: Select all

imagecopy($this->image, $watermark, $watermark_pos_x, $watermark_pos_y, 0, 0, 120, 40); 
replace with this line

Code: Select all

imagecopy($this->image, $watermark, $watermark_pos_x, $watermark_pos_y, 0, 0, $watermark_width, $watermark_height); 
Note you will need to delete all of your images located in

Code: Select all

/image/cache/data/
to get the images recreated for your cache
Thanks JAY6390 so much for ur advice.
I tried but it didn't work. ??? ???

Regard.

ร้านค้าออนไลน์
OpenCart Thailand Support Forum
How to Upgrade oc1.5 to 2.0.1.1
Upgrading OpenCart From v.1.4 or v.1.5 to V.2.2 Step by step


User avatar
Active Member

Posts

Joined
Fri Nov 27, 2009 3:40 pm
Location - Bangkok - Thailand

Post by JAY6390 » Thu Jul 08, 2010 6:24 pm

Have you create a file called watermark.png with an image in the /image/data/ folder? My watermark was actually a jpg file (my avatar off here to be precise)

ImageImageImage

SEO MEGA KIT PLUS - Get your site ranking higher in the search engines
Better Product SEO URL's - Perfectly structured product links
SEO URL's Route Editor PRO - Make ANY url on your site have clean keywords - even third party extensions (remove index.php)


Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by amdev » Fri Jul 09, 2010 11:44 am

JAY6390 wrote:Have you create a file called watermark.png with an image in the /image/data/ folder? My watermark was actually a jpg file (my avatar off here to be precise)
Yes, i did it.

ร้านค้าออนไลน์
OpenCart Thailand Support Forum
How to Upgrade oc1.5 to 2.0.1.1
Upgrading OpenCart From v.1.4 or v.1.5 to V.2.2 Step by step


User avatar
Active Member

Posts

Joined
Fri Nov 27, 2009 3:40 pm
Location - Bangkok - Thailand

Post by JAY6390 » Fri Jul 09, 2010 6:11 pm

Excellent, what was the issue with it?

ImageImageImage

SEO MEGA KIT PLUS - Get your site ranking higher in the search engines
Better Product SEO URL's - Perfectly structured product links
SEO URL's Route Editor PRO - Make ANY url on your site have clean keywords - even third party extensions (remove index.php)


Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by lillolollo » Sat Jul 10, 2010 12:01 pm

For png wtm you must use imagecopymerge not imagecopy

Code: Select all

   imagecopymerge($this->image, $watermark, $watermark_pos_x, $watermark_pos_y, 0, 0, $watermark_width, $watermark_height,75);  

New member

Posts

Joined
Wed May 13, 2009 11:12 am

Post by amdev » Sun Jul 11, 2010 7:29 pm

lillolollo wrote:For png wtm you must use imagecopymerge not imagecopy

Code: Select all

   imagecopymerge($this->image, $watermark, $watermark_pos_x, $watermark_pos_y, 0, 0, $watermark_width, $watermark_height,75);  
Thanks,
Work done!!!

ร้านค้าออนไลน์
OpenCart Thailand Support Forum
How to Upgrade oc1.5 to 2.0.1.1
Upgrading OpenCart From v.1.4 or v.1.5 to V.2.2 Step by step


User avatar
Active Member

Posts

Joined
Fri Nov 27, 2009 3:40 pm
Location - Bangkok - Thailand

Post by dramony » Mon Jul 12, 2010 11:21 am

any screen shots?

User avatar
Active Member

Posts

Joined
Sat Oct 24, 2009 12:34 pm

Post by amdev » Mon Jul 12, 2010 6:28 pm

dramony wrote:any screen shots?
Image of watermark must be .jpg.
Because image in cache/data/ are all of .jpg
so, don't use imagecopymerge() function.

Attachments

watermark.png

watermark.png (51.54 KiB) Viewed 20252 times


ร้านค้าออนไลน์
OpenCart Thailand Support Forum
How to Upgrade oc1.5 to 2.0.1.1
Upgrading OpenCart From v.1.4 or v.1.5 to V.2.2 Step by step


User avatar
Active Member

Posts

Joined
Fri Nov 27, 2009 3:40 pm
Location - Bangkok - Thailand

Post by jty » Fri Jul 30, 2010 11:08 pm

amdev wrote: Image of watermark must be .jpg.
Because image in cache/data/ are all of .jpg
so, don't use imagecopymerge() function.
Hello, I am a litle bit confused. I am reading that the watermark image has to have the same extension as the images. But I am also reading to use a png to get a transaparent watermark

My images are .jpg but I would like to have a "transparent" watermark, either .gif or png.
Is this possible ? I have the watermark working as a .jpg but I need it to be transparent on my .jpg files.

Does this mean that I have to convert my image files to .png or .gif to be able to use the transparency of gifs and pngs ?
Thanks in advance

jty
Active Member

Posts

Joined
Sat Aug 30, 2008 8:19 am

Post by Melanie » Wed Aug 11, 2010 7:31 am

I have exactly the same problem.

My images are all JPG

I want to use a PNG watermark but it wont work.

JPG watermark works fine.

Any advice.......
Thanks,
Melanie.

New member

Posts

Joined
Tue Mar 30, 2010 9:39 am

Post by IOWA » Sat Oct 16, 2010 4:54 am

Why don't you guys just use photoshop or gimp (free open source) to water mark your images?

New member

Posts

Joined
Fri Oct 15, 2010 2:35 am

Post by siuksliadeze » Fri Nov 26, 2010 12:15 am

I just added my watermark "howto" in my post here: http://forum.opencart.com/viewtopic.php ... 59#p114659

Newbie

Posts

Joined
Fri Nov 12, 2010 8:10 pm

Post by arkarwmh » Sun Mar 20, 2011 7:08 am

I found a Watermark code online.
So i combined into my Opencart.

NO NEED OPENCART BUILTIN WATERMARK() FUNCTION.
NO NEED ANY IMAGE FILE FOR WATERMARK.
JUST USE TEXT WATERMARKS.

1. Find this code in the file 'system/library/image.php'
(Its in the save() function)

Code: Select all

if ($extension == 'jpeg' || $extension == 'jpg') {
2. Add following piece of codes AFTER.

Code: Select all

$width = imagesx($this->image);
$height = imagesy($this->image);
$statement = 'Copyright to www.yourwebsite.com';
$fontsize = 2;
foreach (range($fontsize, 1) as $_fontsize) {
	$fontw = imagefontwidth($_fontsize);
	$fullw = strlen($statement) * $fontw;
	if ($fullw + 4 <= $width) {
		break;
	}
}
$fonth = imagefontheight($_fontsize);
$black = imagecolorallocate($this->image, 0, 0, 0);
$gray = imagecolorallocate($this->image, 200, 200, 200);
$white = imagecolorallocate($this->image, 255, 255, 255);

// imagefilledrectangle($this->image, // The graphics object to draw on
	// $width - $fullw - 4,  // The X value of upper left corner
	// $height - $fonth - 4, // The Y value of upper left corner
	// $width,               // The X value of lower right corner
	// $height,              // The Y value of lower right corner
	// $gray);              // The color

imagestring($this->image, // The graphics object to draw on
	$fontsize,            // The font size to use.
	$width - $fullw - 2,  // X value of upper left corner
	$height - $fonth - 2, // Y value of upper left corner
	$statement,           // The text to print
	$gray);              // The color to do it with.

Enjoy!
Regards,
Arkar :clown:
arkarwmh@gmail.com

User avatar
Newbie

Posts

Joined
Sun Mar 20, 2011 7:00 am

Post by W.Creater » Wed Aug 10, 2011 9:13 pm

I have one question about the watermarked images. Is watermarked images are cached by the Google or not?

Newbie

Posts

Joined
Thu Aug 04, 2011 8:10 pm
Location - Canada
Who is online

Users browsing this forum: No registered users and 17 guests