PSOThumbnailGenerator fix width size

Anyone know if it is possible to fix the thumbnail width of an image created by the PSOThumbnailGenerator rather than just restricting the max dimension (Whether this is the height or the width)?

I don’t think it’s supported out of the box, but you can write a custom thumbnail generator that does this. The PSOThumbnailGenerator’s implementation is shown in the thread at http://forum.percussion.com/showthread.php?t=1766 It would be easy to modify this code to always base the scale on the width.

Since I intend to fix the PSOThumbnailGenerator to add Dave H’s scaling algorithm someday soon, I can add this while I’m at it.

The PSOThumbnail generator is positively ancient, and as far back as I can find code for it (I am not the original author), it has always had a single max dimension parameter.

The only question is how to make this upward compatible with the code that is there. Perhaps we should add 2 new optional parameters (maxHeight and maxWidth), and if they are present maxDim is ignored.

Would that work for you ?

Dave

Hey Dave thanks for your response.

Yes your suggestion would be great. The Thumbnail Generator is a superb tool and this would make it even better.

Cheers

Dan

Both the 6.5.2 and 6.6 versions of the PSOToolkit have been updated in the Code & Snippet forum. You can download the latest version and then update your content types to specify a height and/or width on the thumbnail.

Dave

I really like this PSO Tool but I have one suggestion that might make sense for others. Since this is a thumbnail generator and not a photo enlarger, I think it would be benificial to add conditional logic to test the image dimensions before the resize tranformation, if the dimensions are smaller than the resize dimenision(s) specified, then don’t perform the transform/enlarge the photo.