7 replies [Last post]
wbclassics's picture
Offline
Joined: 01/25/2009
Juice: 55
Was this information Helpful?

Ubercart2-B3 on Drupal 6.9

I've added Imagecache Actions that allows native watermarking through ImageCache. Of course the Thickbox images are pulled from a non-ImageCache directory, which means the full size images cannot be watermarked out of the box.

How do I change the directory that that UC's Thickbox pulls the image file from?

i.e. Swap "files/image_0.jpg" to -> "files/imagecache/uc_thickbox/image_0.jpg"

I've already created the imagecache preset uc_thickbox.

Thanks

Kai (#2)

TR
TR's picture
Offline
Bug FinderFAQ ModeratorGetting busy with the Ubercode.
Joined: 11/05/2007
Juice: 3424
Re: Watermarking Thickbox Images w/ Imagecache Actions

Override theme_uc_product_image() to use the URL of your preset rather than the URL of the original image.

It might be useful if this change were put into core, so that theming the thickbox/lightbox "box" would be easier. This would mean a new Ubercart preset which did no scaling by default, and a minor change to theme_uc_product_image() as per above to use this new preset. It would then appear the same as now for everybody by default, but would give your that preset "hook".

<tr>.
wbclassics's picture
Offline
Joined: 01/25/2009
Juice: 55
Re: Re: Watermarking Thickbox Images w/ Imagecache Actions

I agree, it would really be helpful if this was part of the Ubercart core to begin with. If there are five other image size presets specific to Ubercart, why not incorporate the Thickbox preset as well and extend ImageCache's functionality to cover the most important image of them all.

Thanks for your help, I've now got to figure out how to make it work...

Kai #2

wbclassics's picture
Offline
Joined: 01/25/2009
Juice: 55
Re: Re: Re: Watermarking Thickbox Images w/ Imagecache Actions

Was able to get this done today on lunch... not too bad. I followed some of the info posted in the URL below

http://www.ubercart.org/docs/user/2504/watermarking_product_images

I modified the PHP code they offer there for the name of the imagecache preset I was using. Rather than pasting the code in the template.php as recommended on that page, I put it right in the uc_product module, seems to work OK so far!

I'm quickly warming to Drupal and Ubercart. The breadth of customization available because Ubercart plugs into a well developed CMS is amazing. I've been using Drupal and Ubercart for a little more than 20 hours total now and am starting to get comfortable, hopefully by the end of the week I'll have my first live Drupal / Ubercart site up and running.

wbclassics's picture
Offline
Joined: 01/25/2009
Juice: 55
Re: Re: Re: Re: Watermarking Thickbox Images w/ Imagecache Actio

Cleaned the uc_product watermark mod up a little... attached is the altered uc_product.module file (for UC2.0-Beta3) that allows for watermarking of the thickbox images. I've defined the ImageCache preset name as "uc_thickbox" you'll need to create this preset with ImageCache and add the overlay option (for watermarking). Then replace the uc_product.module with the attached one, for UC2.0-B3 (no idea if it works for earlier versions) and you should be good to go.

Kai

AttachmentSize
uc_product.module watermark mod.zip 13.32 KB
TR
TR's picture
Offline
Bug FinderFAQ ModeratorGetting busy with the Ubercode.
Joined: 11/05/2007
Juice: 3424
wbclassics wrote:...
wbclassics wrote:

... attached is the altered uc_product.module file (for UC2.0-Beta3)

Again, I would strongly suggest NOT using this. It would be much more useful to post the overridden theme functions, which are usable by anyone, rather than a modified core module.

<tr>.
Lyle's picture
Offline
AdministratoreLiTe!
Joined: 08/07/2007
Juice: 6846
Re: wbclassics wrote:...

Here's a patch to add a preset called "product_full" to be displayed by Thickbox/Lightbox2 on product pages. No actions are added to it automatically.

Note that this patch is dependent on the one called update_widget.patch in http://www.ubercart.org/forum/support/8933/product_image_field_different.... That's to keep the update functions in the right order.

AttachmentSize
thickbox_preset.patch 3.39 KB
TR
TR's picture
Offline
Bug FinderFAQ ModeratorGetting busy with the Ubercode.
Joined: 11/05/2007
Juice: 3424
wbclassics wrote:Was able to
wbclassics wrote:

Was able to get this done today on lunch... not too bad. I followed some of the info posted in the URL below

http://www.ubercart.org/docs/user/2504/watermarking_product_images

I thought you were using Imagecache Actions? While your link to the Ubercart article describes a method that works, it's a lot of fiddling and modding that is really unnecessary - Imagecache Actions will do all that for you.

wbclassics wrote:

I modified the PHP code they offer there for the name of the imagecache preset I was using. Rather than pasting the code in the template.php as recommended on that page, I put it right in the uc_product module, seems to work OK so far!

Yes, it will work, but it's very bad practice. You'll discover why when you go to update your Ubercart version - the update will blow away all your changes. That's why these things are better separated out into the theme layer and put into template.php.

<tr>.