1

I'm fairly new to EE and currently familiarizing myself with the channels/fields process, and I'm wondering if there's a way-- either natively or with the help of an add-on-- to associate an image or provide a choice of images when publishing via a specific channel?

To provide some context, I have a basic new type feed that displays various events in order of date in a sidebar. The provided channel fields will include event name, date and location. To the side of each entry, I would like to display an image that is specific to that location-- i.e. if a user wants to publish an event that will take place in Chicago, an image specific to that city will show next to the event details text. I realize that I could provide a field for the user to upload an image each time, but given that the range of cities will be finite, I'd like to provide the images beforehand, and either allow the user to select the image appropriate to the given city, or somehow have that image displayed in the corresponding div that is associated with the specific city that is selected/entered into the "city" field.

Is this possible? Please let me know if my question is unclear in any way. Thanks for any assistance here.

0

Sounds like you are not sure yet how you are structuring your site in terms of selecting the city, so here are a couple options:

If your location choices are based on a category, you can use a category image, but that would limit the pic to a default one you setup (So every Chicago event has the same pic): https://ellislab.com/expressionengine/user-guide/cp/admin/channels/category_create.html

If you really want the user to have options from a set gallery, you could look through Dev Demons 'Channel Images' addon: http://www.devdemon.com/expressionengine-addons/channel-images

4
  • Thanks for the response, Jeremy! I should have specified-- there will only be one possible image for each city (we're using train station flip-board type icons for each city-- so whenever an event for Chicago is entered, the corresponding C-H-I image will load alongside the details; and unfortunately due to the nature of the graphic, it can't be styled/created via CSS.) So would this be possible to achieve using native categories? – nickpish Nov 12 '14 at 0:20
  • You haven't provided enough idea of the architecture of your site to say it's the best way, but it IS certainly possible. If there are not too many locations you could also just have a pre-populated dropdown with the location options and in your template a few simple 'if' conditionals could apply the image. If custom_field = (location) img = corresponding image. ellislab.com/expressionengine/user-guide/templates/… There are many ways to do almost anything in ExpressionEngine. – Jeremy Nov 12 '14 at 2:29
  • Too add, if there are not a huge amount of locations, you could also use a grid field to select a location, have an appropriate image and any other supplemental data for the location that is static. ellislab.com/expressionengine/user-guide/add-ons/channel/… – Jeremy Nov 12 '14 at 2:44
  • This is all very helpful, thanks again. The number of locations will likely be no more than 10, so I would imagine the solutions you provided would be sufficient. I will check out the links you've mentioned. – nickpish Nov 12 '14 at 4:50
0

You could do this with relationships.

Set up a channel for "Places" with each place having an image and any other info needed.

Then in your event's channel set up a relationship field which maps to the Places channel.

It's much the same as using categories but can sometimes be easier to work with. It's really down to preference as to how you wish to manage the locations.

1
  • Thanks! I'm still familiarizing myself with all the features of EE; I'll definitely look into relationships as you've described. – nickpish Nov 13 '14 at 4:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.