|
Cookbook /
AutoThumber(redirected from Cookbook.Autothumber) Summary: Automatically resize uploaded images using ImageMagick
Version: 2008-04-05
Prerequisites: PmWiki 2.2.0-beta series, untested on 2.1.27 and earlier. Also requires ImageMagick.
Status: beta
Maintainer: EemeliAro
Questions answered by this recipe
DescriptionAutoThumber allows you to process uploaded images using ImageMagick. Primarily it's meant to allow you to automatically scale images to a maximum resolution and to generate a thumbnail image, but it also provides a way to give any commands that you wish to ImageMagick's convert command. To install this recipe
include_once("$FarmD/cookbook/autothumber.php");
UsageUpload an image file, say ConfigurationThe variable Each entry in the array defines an image, and needs to have default: array('default' => array( 'ext'=>'.orig', 'opt'=>'', 'resize-opt'=>'>', 'maxsize'=>0.9 ), 'big' => array( 'ext'=>'', 'w'=>300, 'h'=>600 ), 'small' => array( 'ext'=>'.small', 'w'=>100, 'h'=>100 ) );
The order of these fields doesn't matter. If you wish to change any of the settings, you'll need to declare the complete array. NotesBy default, AutoThumber only processes images (as defined by $ImgExtPattern, by default includes GIF, JPEG and PNG). Since ImageMagick can read a much wider variety of files and it could be used to generate thumbnails for eg. AVI files. It should be possible to extend this code base to work with PHP's GD library or other utilities. However, I wrote this primarily for my own needs, and hence haven't a good reason (at least yet) to extend the code. Uploading a file that includes the same string as an Release Notes
See Also
ContributorsComments2008-07-06 - Great Recipe ... when I tried to declare a maximum w or h for the default (original), it would not resize. That would be a handy feature as many images that will be uploaded for my application will come directly from digital cameras, and don't need a version larger than (i.e.) 1280 pixels wide on the server. Any suggestions? RussJackman 2008-09-05 - It tryed to use the recipe but when I tryed to upload an image the following error was shown: PmWiki can't process your request ?no such file We are sorry for any inconvenience. When I disable resizing it "works", which means the upload skript doesn't produce this error: $AutoThumberSet = array( 'default' => array(), ); But When I try to use the resize feature it doesn't work anymore. User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki. |