• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Uploading image and thumbnail

 
Tristan Van Poucke
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I created an applet that upload's images using commons.fileUpload.
That worked perfectly but now I wanted to upload a thumbnail of that picture at the sametime, that would be called thumb_picturename.jpg on the server.
the resizing works but I'm having a problem with renaming the files.


All this seems todo is change the original file on my harddisk in size and by name.
I'm probably going to need some kind of buffer to do this.

Can anyone point me in the right direction please?
 
Joe Ess
Bartender
Pie
Posts: 9266
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You didn't show us resizeImage(), so we can't tell what it does, but yes, this line:

will rename whatever on-disk file thumbnail represents to whatever the name of thumbnailren is.
Just in case you don't know, let me point out that File objects don't necessarily represent an on-disk file (hence the exists() method). If you want two files on-disk, you will have to write out data twice.
[ September 02, 2008: Message edited by: Joe Ess ]
 
Tristan Van Poucke
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes but I want to take one file from users disk and put two files with different sizes on the server, without changing anything on the users disk.
 
Joe Ess
Bartender
Pie
Posts: 9266
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So don't invoke renameTo().
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic