locomotivecms / engine

A platform to create, publish and edit sites
http://www.locomotivecms.com
Other
2.32k stars 623 forks source link

multiple image upload #1083

Open truthSeekr opened 9 years ago

truthSeekr commented 9 years ago

How can I achive multiple image/file upload ? I have "Gallery" entry that has many "Photo" entries, but I can only add one photo...

did commented 9 years ago

@truthSeekr Does your photo content type have fields other than the file one? I'm asking you that because, perhaps, we just need a "gallery" field type.

truthSeekr commented 9 years ago

Yes my photo content type has fields other then file. It looks like this.

Photo content_type

fields: 
- desc: # Name of the field
    label: Opis
    type: string
    required: false
    hint: widoczny przy powiększeniu zdjęcia
    localized: false

- image: # Name of the field
    label: Plik (zdjecie)
    type: file
    required: true
    hint: "format *.jpg, *.png"
    localized: false

- gallery:
    label: Galeria
    type: belongs_to
    required: true
    localized: false
    class_name: galleries

and Gallery content type is like this:

fields: 
- name: # Name of the field
    label: Nazwa
    type: string
    required: true
    hint: 
    localized: false

- place: # Name of the field
    label: Miejsce
    type: string
    required: false
    hint: opcjonalne
    localized: false

- data: # Name of the field
    label: Data
    type: date
    required: false
    hint: opcjonalne
    localized: false

- photos:
    label: Zdjecia
    type: has_many
    required: false
    localized: false
    class_name: photos
    inverse_of: gallery
    ui_enabled: true

I add photos through gallery entry. So if the photo wouldnt have other fields than file I could upload multiple files at once ?


I tried to change 'photo content type' to contain only this:

- image: # Name of the field
    label: Plik (zdjecie)
    type: file
    required: true
    hint: "format *.jpg, *.png"
    localized: false

with/without association

- gallery:
    label: Galeria
    type: belongs_to
    required: true
    localized: false
    class_name: galleries

I think only "file" type input should have option for multiple uploads. Then there is no need for having photo content type, everything is in gallery( description of photo is less important in this case ). Like you said "perhaps, we just need a 'gallery' field type".

did commented 9 years ago

hey @truthSeekr! If the description is not important to you, yes, the 'gallery' field type would make totally sense here. We also could imagine something more powerful. We could tell a content type with a file field to act like a gallery. This way, that would enable some new functionalities like multiple uploads, display the content entries as a image grid....