Hi folks,
First of all, I'm new to Plone so please forgive me if I don't express this too well.
I need to do the following:
Display an image on a page along with the supporting information (I have subclassed ATImage to add additional fields/widgets and this works fine).
When the user clicks on the 'Current Image - ...' link below the image, I want to display the image at a different size, depending upon the user's defined role. Privileged users will see a full size image while others will see a scaled down image. I have the sizes defined in the ImageField.
One way to do this would be to create a method in my subclassed ATImage class that returns a different-sized image using a test based on user.hasRole() - image_large, image_mini etc. However, I notice that the image.pt file (in Archetypes/skins/archetypes/widgets) includes a link to the image file's absolute URL so I need to modify this.
A brute force approach would be simply to modify image.pt to call my method but that's a bad idea since it will affect all images.
I can subclass ImageWidget, which is a more elegant approach, and simply specify the new widget for my existing ImageField. However, I can't see where to define the link between the widget and the page template. Any pointers would be greatly appreciated.
On the other hand, I may be approaching this from completely the wrong direction, so suggestions on alternative approaches would also be welcome.
Many thanks in advance,
Neil Stokes