Author Topic: VM2 - Picture Watermark  (Read 5990 times)

Zekule

  • Beginner
  • *
  • Posts: 16
VM2 - Picture Watermark
« on: February 22, 2012, 14:19:25 pm »
Is there any way or code to insert a watermark on the product pictures?

Thanks.

morktron

  • Jr. Member
  • **
  • Posts: 120
    • digital solutions for sentient bipeds
Re: VM2 - Picture Watermark
« Reply #1 on: February 22, 2012, 23:34:41 pm »
Yes, you can do it with Magic Zoom Plus, you have to pay for it but it's worth it since they have great support and it all works for VM2.5 - unlike most things!

I have it working on this site in development - only for the product fly pages though

shyntaxx

  • Beginner
  • *
  • Posts: 33
    • Motorola unlock
Re: VM2 - Picture Watermark
« Reply #2 on: January 15, 2014, 03:39:58 am »
This is a prefectly easy and free solution for watermaking images :::

Apply Watermark image into Product Image of Virtuemart

Problem: When Creating an shopping website, we would like to apply a watermark image - logo and website name - on every picture of products. It is seem easy by this way: use an watermark program to apply icon on product picture, then upload that picture on hosting. Take a long time if you have over 50 products.
I want to do this work automatically, It means watermark picture will be applied in to all picture (old and new) of website

Solve: I do this work on Joomla 2.5 and Virtuemart 2.0. But I think it is comfortable for every happen load and show Image.
Step 1: Create file .htaccess on folder contain image, with Virtuemart 2.0, this folder is <your_domain>/images/stories/virtuemart/product.



RewriteRule ^(resized)($|/) - [L]

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} -f

RewriteRule \.(gif|jpeg|jpg|png)$ watermark.php [QSA,NC]


Step 2: Create file watermark.php at same folder of .htaccess with content:


<?php

// watermark.php
// Path the the requested file

$path = $_SERVER['DOCUMENT_ROOT'].$_SERVER['REQUEST_URI'];
// Load the requested image

$image = imagecreatefromstring(file_get_contents($path));$w = imagesx($image);$h = imagesy($image);
// Load the watermark image

$watermark = imagecreatefrompng('watermark.png');$ww = imagesx($watermark);$wh = imagesy($watermark);
// Merge watermark upon the original image (centred)

imagecopy($image, $watermark, (($w/2)-($ww/2)), (($h/2)-($wh/2)), 0, 0, $ww, $wh);

// Send the image

header('Content-type: image/jpeg');imagejpeg($image,null,95);
exit();?>

Step 3: Create an watermark.png with transparent background and upload to that folder.
Done.
Now you can test all image file in folder <your_domain>/images/stories/virtuemart/product have watermark if you call them on your website

Note: the code line RewriteRule ^(resized)($|/) - [L] in .htaccess file ensure that all thumbnail file in resized folder will be not watermarked. If you want to watermark on both thumbnail and large picture, you can remove that line

CREDITS: mtkcode.blogspot.hu/2013/07/apply-watermark-image-into-product.html

fkeller

  • Beginner
  • *
  • Posts: 4
Re: VM2 - Picture Watermark
« Reply #3 on: April 05, 2018, 08:30:11 am »
My VM3 product pictures are NOT in:

Quote
<your_domain>/images/stories/virtuemart/product.

So if it isn't working for you try to put everything in:

<your_domain>/images/virtuemart/product


jenkinhill

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 26992
  • Always on vacation
    • Jenkin Hill Internet
Re: VM2 - Picture Watermark
« Reply #4 on: April 05, 2018, 11:18:50 am »
Four years ago, when the old thread you posted to was written, Joomla was at J2.5 and VM was at VM2.0  Things have changed since then!

The stories folder has been removed from Joomla 3 so VM product images are now stored in images/virtuemart/product
Kelvyn

Jenkin Hill Internet,
Lowestoft, Suffolk, UK

Unsolicited PMs/emails will be ignored.

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Currently using VM 3.4.0.9935 on Joomla 3.8.12 PHP 7.0.31
Testing VM 3.4.0.9941 on Joomla 3.8.12