Re: Dynamic Image resizing for thumbnail view with correct Aspect...
Re: Dynamic Image resizing for thumbnail view with correct Aspect...
- Subject: Re: Dynamic Image resizing for thumbnail view with correct Aspect...
- From: Wolfram Stebel <email@hidden>
- Date: Tue, 26 Jul 2005 22:45:22 +0200
Am 26.07.2005 20:03 Uhr schrieb "Mike Schrag" unter
<email@hidden>:
> If you mean you just want the browser to show them smaller (i.e.
> users will still be sent the 700 px wide version, but it will look
> smaller), then you can just specify width = "200" on your WOImage and
> the browse will adjust the height proportionally. If you want access
> to image sizes and don't mind private frameworks, you can use
> com.webobjects.appserver._private.WOImageInfo:
>
> URL urlToImage = ...
> WOImageInfo wii = new WOImageInfo(urlToImage);
> int width = wii.width();
> int height = wii.height();
>
> If you actually want to create thumbnails, there are a bunch of ways,
> but none of them necessarily _simple_ -- JAI, ImageMagick system
> call, JNI to various image libraries, etc.
i did not know about WOImageInfo (THANKS) but have a class from the web:
public class ImageInfo {
* @author Marco Schmidt
Someone in the last month mailed, one can use "sips". i do it this way and
it works ok (see "man sips"):
String command = "sips -Z 400 -s format jpeg -s formatOptions low " +
outputFilePath + " --out " + thumbedOutputFilePath;
Process p = Runtime.getRuntime ().exec ( command );
if ( NSLog.debugLoggingAllowedForLevel ( NSLog.DebugLevelDetailed ) )
{
NSLog.out.appendln ( "Thumbing process waiting " );
}
int terminated = p.waitFor ();
if ( NSLog.debugLoggingAllowedForLevel ( NSLog.DebugLevelDetailed ) )
{
NSLog.out.appendln ( "Thumbing result: terminated (0=OK) : " +
terminated );
BufferedReader in = new BufferedReader( new InputStreamReader (
p.getErrorStream () ) );
NSLog.out.appendln ( "Thumbing error : " + in.readLine () );
}
Wolfram
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden