What will this do?
This mod will allow you to change the size of your images from the Upload Module without having to generate a new thumbnail size. It also allows you to crop images using a set ratio. This is useful if you want to generate cropped and squared versions of uploaded images. The script will cache a local copy of the resized image in your /cache directory.
Before (left) and after (right) 1:1 100px crop.


First, grab and upload the attached image.php file from this thread to your pligg base directory. It is a slightly customized version of the SIR file. The only thing changed is the cache directory.
Second, open up your Upload Module settings page. Find the input field for "Manual Thumbnail HTML format" and paste in the following code, changing the domain.com example with your own domain/subdirectory information.
Code:
<a href="{target}"><img src="http://www.YOURDOMAIN.COM/SUBDIRECTORY/image.php?width=200&height=200&cropratio=1:1&image=http://www.YOURDOMAIN.COM/SUBDIRECTORY{path}" /></a> The previous example would crop the image to a square size (1:1 ratio). You can remove the cropratio expression from the line above (&cropratio=1:1) if you do not want to crop the image and change it's aspect ratio. The height and width values used (200 and 200) are used to determine the maximum height or width of the image. If an image is 600px wide by 150px tall it will use the wider side (600px) to shrink the image down to 200px by 50px, preserving the aspect ratio so that the image doesn't become distorted. The Upload Module will do pretty much the same thing, but it requires you to set a new thumbnail size for all of the images on your site. The module does not allow you to crop the image though, so that feature is unique to this method.






Linear Mode



