2

I have an area on my homepage for an image. I would like this image to change on a daily basis.

I would like to queue up images so they are ready.

I know i could set a channel for these images and schedule them via expiring etc, but I was thinking there must be an easier way!

Any ideas?

4

Another simple idea... Name your images like this:

December-1.jpg
December-2.jpg
December-3.jpg

Manually upload the images to the server... in your template call image like this:

<img src="/path/to/images/{current_time format="%F-%j"}.jpg">

The image for the current day will always be called.


EE date formatting options are here:
http://ellislab.com/expressionengine/user-guide/templates/date_variable_formatting.html

1
  • I like this idea! :)
    – shorn
    Dec 20 '13 at 0:13
6

Your option is a good one and not hard at all.

Instead of expiring the entries, I would future date them and set limit="1" on your channel:entries tag. This way an entry will always appear. With expiring you risk human error causing an image not appearing.

2
  • Just trying to think this through. So say, for example, I want to upload 30 images (a months worth) I would set the entry date of each image one day ahead of the next. and set the limit to 1. Am I right in thinking that by setting the limit to 1, it would only display the most recently added image?
    – shorn
    Dec 18 '13 at 1:44
  • Set the entry date to the date/time you want the image to start showing on the site. Limit="1" will always show the entry with the most recent date. Future dated entries won't show. The channel:entries tag defaults to ordering by date with most recent at top.
    – Anna_MediaGirl
    Dec 18 '13 at 1:52
3

If you don't want to use channels, use low variables with a grid field with days of the week as the grid rows. Give each a file upload field and an alt field then use some logic on the template to get the day and call the low var for that day.

Simple example, not verbatim code purely reference

Grid field:

date_1 | imgxx | alt title

date_2 | imgyy | alt title

...

date_31 | imgzz | alt title

{exp:low_variables:parse var="my_dates"}
{grid_field search:date_field="date_{current_time format="%j"}
<img src="{grid_field_img_column}" alt="{grid_field_alt_title}" />
{/grid_field}
{/exp:low_variables:parse}
3
  • Like the idea of using Low Variables for this, but wouldn't this method mean that I can only do 7 at a time?
    – shorn
    Dec 18 '13 at 1:40
  • 1
    Simply create 31 fields not 7 and you'd simply get the date (1,2,3...27,28 etc) and marry it to the corresponding low variable field, simple. Dec 18 '13 at 5:55
  • Thank you for the added example. I shall consider it, but I think initially (at least) i'm going to go with the direct solution posted.
    – shorn
    Dec 20 '13 at 0:15
1

Hmm, maybe this is a long shot if you want manual control, but to refresh an image once a day you could also try something like this:

{exp:channel:entries channel="images" cache="yes" refresh="1440" orderby="random"} {/exp:channel:entries}

1
  • That would work, but I do want to control what images are showing when (for example, wintery photos in winter etc) rather then let it be randomised.
    – shorn
    Dec 20 '13 at 0:14

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.