Check if image already exists

Images added to each Choice. Images displayed as scaled down icons. Main image swaps when the Choice is selected.
Post Reply
jont
Posts: 12
Joined: Sun Sep 07, 2008 10:18 am

Check if image already exists

Post by jont »

Hi Norman,

working on an existing implementation of the DCI plugin for v9.0.2 and it appears the images are being generated and sent with each upload. Is there a way to prevent this with the existing functionality? From memory on the main Actinic forum regarding the product rescaled hack you mentioned your plugins check the #hash to check if changed but unable to see this in operation.

Jont
jont
Posts: 12
Joined: Sun Sep 07, 2008 10:18 am

Re: Check if image already exists

Post by jont »

Just found in the external php

if ( md5_file('mtempimage.jpg') != md5_file($filename) ) // see if they're different

which is checking the file #hash

.... so am I missing the reasoning on how the files are generated afresh? I am working just on 1 section with radio images and modifying the main product layout but not the DCI layouts.
norman
Site Admin
Posts: 1252
Joined: Sat Feb 07, 2004 9:55 pm

Re: Check if image already exists

Post by norman »

This patch writes any images (small icons and main replacement images) to a temp file. It then check that this temp file is different from any existing image before updating the existing image. This is the code you noticed.

Consequently, the icons and replacement images should not be uploaded unless they've changed.

There are some situations where the Choice images would be refreshed:

1) Changing the main product image for one with a different size would cause an update.

2) If you're using the option to set the background colour of the new images from the top-left pixel of the main product image, then changing the product image would again force new choice images.

3) Altering choice image parameters (JPG compression, etc).
jont
Posts: 12
Joined: Sun Sep 07, 2008 10:18 am

Re: Check if image already exists

Post by jont »

It appears to be whenever I edit the product layout it generates the dynamic thumbs. This could be due to the PHP main product resize script I also have with the layout ... wondering if the PHP process on the main image is forcing the hand of the dynamic images?

Hopefully the product layouts are now nailed so it will not be an issue in the future.

Thanks again Norman,

John
Post Reply