How to use it???
Regards.
Amdev
ร้านค้าออนไลน์
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
Code: Select all
/catalog/model/tool/image.php file
Code: Select all
$image = new Image(DIR_IMAGE . $old_image);
Code: Select all
$image->resize($width, $height);
Code: Select all
$image->watermark(DIR_IMAGE . 'path/to/image/in/image/folder.png', 'position-name-here');
- topleft
- topright
- bottomleft
- bottomright
Note this has not been tested, but should work
Me too, it didn't work.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
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);
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
Edit the file
Code: Select all
/system/library/image.php
Code: Select all
imagecopy($this->image, $watermark, $watermark_pos_x, $watermark_pos_y, 0, 0, 120, 40);
Code: Select all
imagecopy($this->image, $watermark, $watermark_pos_x, $watermark_pos_y, 0, 0, $watermark_width, $watermark_height);
Code: Select all
/image/cache/data/
Thanks JAY6390 so much for ur advice.JAY6390 wrote:Seems there was an error in the watermark code
Edit the filefind this lineCode: Select all
/system/library/image.php
replace with this lineCode: Select all
imagecopy($this->image, $watermark, $watermark_pos_x, $watermark_pos_y, 0, 0, 120, 40);
Note you will need to delete all of your images located inCode: Select all
imagecopy($this->image, $watermark, $watermark_pos_x, $watermark_pos_y, 0, 0, $watermark_width, $watermark_height);
to get the images recreated for your cacheCode: Select all
/image/cache/data/
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
Yes, i did it.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)
ร้านค้าออนไลน์
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
Code: Select all
imagecopymerge($this->image, $watermark, $watermark_pos_x, $watermark_pos_y, 0, 0, $watermark_width, $watermark_height,75);
Thanks,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);
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
Image of watermark must be .jpg.dramony wrote:any screen shots?
Because image in cache/data/ are all of .jpg
so, don't use imagecopymerge() function.
Attachments
watermark.png (51.54 KiB) Viewed 26473 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
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 watermarkamdev wrote: Image of watermark must be .jpg.
Because image in cache/data/ are all of .jpg
so, don't use imagecopymerge() function.
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
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') {
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.
Regards,
Arkar
arkarwmh@gmail.com
Users browsing this forum: No registered users and 95 guests