Forums / General / Multiple Images in a content class

Multiple Images in a content class

Author Message

Gert

Wednesday 26 November 2008 1:24:30 am

Hi,

In order to assign 5 images to a content class that will not be used anywhere else I would usually add 5 fields for images.

Is there a way to create some sort of an array of image fields so that the users decide how many images they want to upload and then read an array of uploaded images?

I'm now working on a project where up to 15 images should be uploaded, but sometimes it will just be one and I want to avoid to have 15 image upload fields in my content class.

Thanks in advance,

Gert.

canguro web solutions
consulting & development
http://www.canguro.at

Arnaud Lafon

Wednesday 26 November 2008 1:51:30 am

Hi Gert,

maybe you could use the "global object relation" using the form you have at the bottom of the content object edit page.

Then you can fetch that object using

fetch( 'content', 'related_objects', hash( 
'object_id',            object_id,
'all_relations', array( 'common' ) ))

Hope this helps

Arnaud

Looking for information about SQLI ?
Looking for a new job in Paris ?
Please contact me at alafon [at] sqli [dot] com

Gert

Wednesday 26 November 2008 2:26:55 am

Hi Arnaud,

Thank you very much for your soon reply and the detailed explanation!

As I understand the concept, using object relations means that users
would leave the content class form for each image they want to upload
and then come back.

As my users are very often little experienced I would prefer a method
where the user does not leave the form and possibly has just one or
two buttons to handle multiple image uploads. This is why at the moment
I have got 5 image upload fields, because it's a lot easier for my users
and when doing updates with great frequency it's also a lot faster.

What do you think?

Gert.

canguro web solutions
consulting & development
http://www.canguro.at

Arnaud Lafon

Wednesday 26 November 2008 4:24:40 am

Actually, your user won't leave the content edit page and will be redirected after they upload the image (as a new content object which can be uploaded under the current object this one is instanciated on a container class).

(Note that there was a bug on ezp 4.0 that missredirected the user on a blank page)

Looking for information about SQLI ?
Looking for a new job in Paris ?
Please contact me at alafon [at] sqli [dot] com