What's the best location to put the Images, databse ou public folder?

Hi, I have a Form that has some fields, such as TextField, Combobox and Image, my questions is, What’s the best location to put the Image?

Load from database? load from public folder?

I think that is the best choice is public folder, because in the database I post only a String with address of the image in the public.

I’m using JPAContainer

Another question, how can I use ImageField with JPAContainer?

It completely depends on your application data design where you store the images. Loading from the filesystem may be more or less efficient than from database, depending on the filesystem, the database, and whether you arrange some sort of caching in memory perhaps, etc.

If you really want to go for efficiency, you may want to store static resources such as images, themes, and widget sets, in a front-end server, so that the application server doesn’t have to spend time in serving such requests. How you refer to those resources depends on how you organize them. You could store them under a theme and refer to them with ThemeResource, or by any URL path with ExternalResource.

The Image component is not a field (as it doesn’t have a value), so you can’t use FieldGroup to handle binding. You need to handle setting the resource from the item property value explicitly. I don’t know if there’s currently any ready examples of that. You could, of course, wrap it in a CustomField and handle setting the resource in setInternalValue().

Marko, thanks for explanation, I’m gonna store the files in Amazon S3 and load ir from ExternalResource as you told me, I think this is more efficiente, so imagine that you can upload a image about 500k, I think this will increase the database only with 1 image, in this scanario, I think the best choice to store files is in “Filesystem”

I think I’ll create a custom “image field” to automatize the load of the images as you said.

My application is hosted in amazon using Beanstalk feature