Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2015-07-27 19:20:18

giampablo
Member
From: Italy
Registered: 2008-07-17
Posts: 86
Website

Future photos in galleries

Is it possible to add a photo to an existing gallery at a certain date in the future?
I.E. I would like to upload the image today, designate the image category, caption and so on, and make it visible next week.

Thanks

Offline

#2 2015-07-27 21:15:27

etc
Developer
Registered: 2010-11-11
Posts: 5,053
Website GitHub

Re: Future photos in galleries

If you can modify txp_image.date value (phpMyAdmin, say), it should be possible to filter out the images with future date. How (core, plugin) depends on the gallery script you use.

Offline

#3 2015-07-27 21:16:42

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

Re: Future photos in galleries

I don’t believe there’s a neat, native way to do this.

The core does have a date field in the table, but it’s only used behind the scenes to store when the image was uploaded. A plugin could add the ability for you to alter this date and maybe offer a way for you to limit the output.

Failing that, if you edit the image date field in phpMyAdmin or something, you could trick your page by assigning the output of <txp:image_date> to a txp:variable and testing it using smd_if or similar date-based conditional plugin in your <txp:images> container.

The downside is you would have to use a large limit attribute and probably employ client side code to paginate, since there’s the possibility that some of the images won’t show up in any given set.

EDIT: etc was faster and more concise!

Last edited by Bloke (2015-07-27 21:18:11)


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

#4 2015-07-27 21:21:26

etc
Developer
Registered: 2010-11-11
Posts: 5,053
Website GitHub

Re: Future photos in galleries

Looks like a feature request for smd_gallery. :)

Offline

#5 2015-07-27 21:28:16

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

Re: Future photos in galleries

etc wrote #293752:

Looks like a feature request for smd_gallery. :)

Rats, I was hoping to let that plugin die in a corner somewhere. But not until it used up all its energy kicking smd_slimbox and smd_random_banner to pieces.


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

#6 2015-07-29 14:09:27

giampablo
Member
From: Italy
Registered: 2008-07-17
Posts: 86
Website

Re: Future photos in galleries

Actually, it is a slideshow not a gallery. I am using ResponsiveSlides query plugin and native txp tags.
It’s dead simple to add an image with category “slides”, for instance.
All images in that category will show up in the slider.
So, my actual problem is to designate image category in a future date.
Uploading the image today does not affect the slideshow until a give category = slides, at that moment that image will be added to the slideshow.

Thanks anyway

Offline

#7 2015-07-29 17:25:01

maruchan
Member
From: Ukiah, California
Registered: 2010-06-12
Posts: 590
Website

Re: Future photos in galleries

So, my actual problem is to designate image category in a future date.

That shouldn’t be hard to do with some scripting. It might be easiest to do with a PHP script in a cron job.

First, create a category for the images called future_slides. Assign the images to that category.

Then, the general code would look like this:

if (today >= future_date)
    SQL query --> change all images with the category "future_slides" to the category called "slides"
end if

You can test your SQL in PHPMyAdmin or another script or TXP plugin like that, to make sure it works.

Then put the completed PHP code in a cron job to be run periodically, once a day in the early morning, for example.

Your TXP code could just be constantly trying to create a gallery out of images in the “slides” category. It would output nothing if it doesn’t find images in the “slides” category.

Offline

#8 2015-07-29 17:48:30

maverick
Member
From: Southeastern Michigan, USA
Registered: 2005-01-14
Posts: 976
Website

Re: Future photos in galleries

I’m probably missing something, but this almost sounds like a feature idea: to add a publish/expire feature to images and files, making them consistent with articles.

Offline

#9 2015-07-30 11:47:47

etc
Developer
Registered: 2010-11-11
Posts: 5,053
Website GitHub

Re: Future photos in galleries

giampablo wrote #293805:

So, my actual problem is to designate image category in a future date.

That may be not ideal, but if you publish your images (say) weekly, you can name their categories like slides-2015-26, and then generate a “by week” category list from some initial date to now, in php or plugin:

<txp:etc_date date="2015-01-01..now::604800" format="slides-%Y-%W" break="," />

You then pass this list as category attribute to <txp:image />.

maverick wrote #293808:

I’m probably missing something, but this almost sounds like a feature idea: to add a publish/expire feature to images and files, making them consistent with articles.

That’s a good and natural idea, and it would be even better to merge articles, images, files and other data contents into some common structure, and extend it with custom fields in every particular case.

Offline

#10 2015-07-30 13:35:22

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

Re: Future photos in galleries

maverick wrote #293808:

add a publish/expire feature to images and files, making them consistent with articles.

Plus: Add a new form type “image”. Tcha, Bert, don’t make me think :)


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

Offline

#11 2015-07-30 16:17:21

maverick
Member
From: Southeastern Michigan, USA
Registered: 2005-01-14
Posts: 976
Website

Re: Future photos in galleries

etc wrote #293826:

it would be even better to merge articles, images, files and other data contents into some common structure, and extend it with custom fields in every particular case.

I have long thought that seemed sensible. I’ve always presumed it would require a rewrite from the ground up. I think xPattern was part way to having it work this way.

Offline

#12 2015-07-30 17:38:33

giampablo
Member
From: Italy
Registered: 2008-07-17
Posts: 86
Website

Re: Future photos in galleries

maverick wrote #293808:

I’m probably missing something, but this almost sounds like a feature idea: to add a publish/expire feature to images and files, making them consistent with articles.

Maverick nailed it.
I cannot imagine many use cases other than mine to justify a feature request.
But that’s just me and maybe I am wrong: a publish/expire feature for images and files may be useful to many users in different scenarios.

Offline

Board footer

Powered by FluxBB