Jump to content

Add multiple images to template


mobility
 Share

Recommended Posts

Sorry for the newby question, but how do I add the ability to put multiple images into a template?

I go in and edit the template and it will let me add one image, but not a second or third, etc.  The option becomes faded out and not selectable.

Thanks in advance!

Link to comment
Share on other sites

Do you really want to have multiple image fields; or do you just want the ability to add multiple images to the same image field?

The image fieldtype in ProcessWire supports multiple images - you just need to tell it so, when you go to Setup > Fields.

A template can only have one occurrence of a field added to it. If you want more - you can either create multiple fields of the same type and settings but different names, or use repeaters.

Have you read over the Images section of the documentation? It might help narrow down what you want to achieve.

  • Like 4
Link to comment
Share on other sites

Thanks all.  I think the setup > fields is probably what I am looking for.  I am just very new to processwire and will definitely read the documentation on images.  

Does allowing multiple uploads in this manner allow for tagging the images to use in different places on the page?  

Link to comment
Share on other sites

Yes, you can call $pages->imagefield->first()->url or $pages->imagefield->eq(n)->url in separate spots in your template, but that doesn't mean it is easiest in all situations.

Typically using one images field with support for multiple images is good for sliders/carousels and image galleries, and for insertion into body text, but if you are talking about wanting to add a specific sidebar image and a main article image or similar setup, I would go with two separate image fields set to support only one image. It really depends on your scenario and what works best for you and your clients.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...