Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-10-05 16:30:25

qp2wd
Member
Registered: 2011-01-11
Posts: 24

Image Expire Date -- is it possible?

On one of my client sites there’s a rotating banner that contains web ads for upcoming events. If possible, I’d like a way to set an expire date to these images so that I don’t have to keep track of an event’s end date and manually go back in to remove the image.

To be more specific, I’d want it to be an if/then sort of solution. IF the expiry date has been reached, THEN execute something. For example, set the image category to none, or remove the thumbnail, or do edit one of the other traditional image parameters. I’m sure this involves a lot of script, but I was wondering if there was already a plugin around to accomplish this.

Offline

#2 2011-10-05 17:36:39

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Image Expire Date -- is it possible?

Couldn’t you just make it an article (with article_image)?

Offline

#3 2011-10-05 18:04:26

qp2wd
Member
Registered: 2011-01-11
Posts: 24

Re: Image Expire Date -- is it possible?

I thought of that, but I didn’t want the articles section getting clogged with “placeholder” articles for images.

Offline

#4 2011-10-05 19:11:56

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,315

Re: Image Expire Date -- is it possible?

Sounds like a job for baby (No offense, it’s a login name ;)

Not yet tried, but it seems like the best choice among the date/time filters I have here.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#5 2011-10-06 14:55:02

qp2wd
Member
Registered: 2011-01-11
Posts: 24

Re: Image Expire Date -- is it possible?

What a great plugin! I’m trying to think of how I’d best integrate it into my current workflow. The images for the slideshow are currently being generated by smd_gallery. On each image, both the alt text and caption are in use for generating other content, and those are the spaces I’d normally use to test a conditional statement against. I guess that’s the problem I’m running into overall— without any additional conditions to test against, how can I tell a plugin what needs to be switched out?

Offline

#6 2011-10-07 13:08:43

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,315

Re: Image Expire Date -- is it possible?

Not sure, what your question is about: Do you need an additional criterion or a method to fill in dynamic dates into ort_ifdate?


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#7 2011-10-07 13:29:14

qp2wd
Member
Registered: 2011-01-11
Posts: 24

Re: Image Expire Date -- is it possible?

In this case I’d need an additional criterion. There’s no place for me to indicate in the image parameters what an individual image’s expiry date should be; ordinarily this is something I would put in as the image’s alt text or caption, but both of those fields are currently in use in the client’s site.

Offline

#8 2011-10-09 12:13:27

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,315

Re: Image Expire Date -- is it possible?

I’ve not seen something like custom fields for images, thus you’ll probably need to manipulate the image’s date itself. I’ve a faint memory I saw a screenshot of the Image tab manipulated in a way that you could enter a edit the date there. Edit: Geez, the Image tab itself, unmanipulated. Never needed that, so I completely ignored the date fields :] See #14.

Last edited by uli (2011-10-12 18:51:13)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#9 2011-10-09 13:05:33

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,477

Re: Image Expire Date -- is it possible?

Els schrieb:

Couldn’t you just make it an article (with article_image)?

qp2wd schrieb:

I thought of that, but I didn’t want the articles section getting clogged with “placeholder” articles for images.

@ qp2wd: Why do you ignore the suggestion of Els? It solves your problem. What do you mean with clog the article section?

Offline

#10 2011-10-09 14:00:54

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,947
Website GitHub

Re: Image Expire Date -- is it possible?

Don’t the web ads relate to an article? i.e. if you click one of the ads, what happens? If they relate to an article then I agree that Els’ approach makes a lot of sense but if the advert itself contains all necessary info and there are no ‘more details’ that you need to impart on click, then I agree it’s tricky.

I presume there’s no set time in advance that an image is uploaded? If there was you could perhaps use a system whereby it’s deleted or has its category changed when the upload date + 4 weeks (for example) has elasped.

The other (cheating) way is to use the alt/caption but employ a special syntax like [EXP:2011-11-20] at the end of the alt. You can strip this off with the pax_grep plugin when displaying it using <txp:image_info /> so nobody would know it’s there. But then in a different part of the page you could read that value, check it and act on it if ‘now’ is > that date.

Last edited by Bloke (2011-10-09 14:01:38)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#11 2011-10-10 13:07:57

qp2wd
Member
Registered: 2011-01-11
Posts: 24

Re: Image Expire Date -- is it possible?

@Bloke — This slideshow does indeed fall into the second case— all relevant details for the event are in the image, so there’s no ‘more info’ page for it. And no, there’s no set time for when images are uploaded. It’s really whenever we get around to finishing the latest ad.

Your last suggestion sounds promising, and I have an idea of how I could integrate it with smd_gallery. I’ll give it a go when we upload our next ad!

Offline

#12 2011-10-10 13:11:01

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,947
Website GitHub

Re: Image Expire Date -- is it possible?

qp2wd wrote:

Your last suggestion sounds promising, and I have an idea of how I could integrate it with smd_gallery.

Cool. If you’re using 4.3.0+ you can probably do it with the native image tags. Save a plugin; save the world.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

Board footer

Powered by FluxBB