Take the 2-minute tour ×
ExpressionEngine® Answers is a question and answer site for administrators, end users, developers and designers for ExpressionEngine® CMS. It's 100% free, no registration required.

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?

share|improve this question
add comment

4 Answers 4

up vote 4 down vote accepted

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

share|improve this answer
    
I like this idea! :) –  shorn Dec 20 '13 at 0:13
add comment

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.

share|improve this answer
    
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
    
Got it, thank you. –  shorn Dec 18 '13 at 2:03
add comment

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}
share|improve this answer
    
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. –  stuartmcd69 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
add comment

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}

share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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