Re: sizing down an uploaded photo
Cosmin Cremarenco <[email protected]>
| Newsgroups | gmane.comp.java.sun.servlet |
|---|---|
| Message-ID | <[email protected]> |
hi
we use sun's jimi and getScaledInstance to produce thumbnails from user
uploaded photos
public static void scaleImage(String path,String imageName,int width,int
height,int xScaleTo,int yScaleTo)
throws Exception
{
System.out.println("scaleImage: "+path+imageName);
Image image = Jimi.getImage(path+imageName);
Image otherImage = null;
if (width>=height){
yScaleTo=-1;
}else{
yScaleTo = xScaleTo;
xScaleTo = -1;
}
otherImage = image.getScaledInstance(xScaleTo, yScaleTo,
Image.SCALE_SMOOTH);
Jimi.putImage("image/jpeg", otherImage,
path+"t"+Utils.changeExt(imageName,"jpg"));
}
Hope that helps
Cosmin
----- Original Message -----
From: "Carter, Scott" <[email protected]>
To: <[email protected]>
Sent: Wednesday, May 07, 2003 1:03 AM
Subject: sizing down an uploaded photo
> I am hoping that someone using servlets has encountered this problem. I
> have a web site where user's can upload photos, but after the servlet
> uploads the file I would like it to also resize the deminsions of the
> picture and the quality (size). Has anyone run into this problem?
>
> Thanks - Scott
>
>
___________________________________________________________________________
> To unsubscribe, send email to [email protected] and include in the
body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html