Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2012-12-12 11:20:46

Algaris
Member
From: England
Registered: 2006-01-27
Posts: 572

Using an articles images name instead of id

On the write tab where you enter the article image is it possible to use an images name as defined in the images tab?

I’m trying to move away from using IDs and using the images ID as its filename for article images. e.g images/23.jpg

Offline

#2 2012-12-12 11:31:26

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

Re: Using an articles images name instead of id

Algaris wrote:

is it possible to use an images name as defined in the images tab?

Yes, once way to do it is to change the way you pull in the contents of the article_image field:

<txp:if_article_image>
   <txp:images name='<txp:custom_field name="article_image"/>' />
</txp:if_article_image>

You can list names too using that code in your article form.

Last edited by Bloke (2012-12-12 11:32:09)


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

Online

#3 2012-12-12 14:41:08

Algaris
Member
From: England
Registered: 2006-01-27
Posts: 572

Re: Using an articles images name instead of id

Excellent that’s just what I needed to know, thanks Stef. Now I just need to figure out a way to implement it without breaking backwards compatibility for all the article images I’ve used with IDs.

Offline

#4 2012-12-12 15:03:29

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,172
Website GitHub Mastodon Twitter

Re: Using an articles images name instead of id

Algaris wrote:

Now I just need to figure out a way to implement it without breaking backwards compatibility for all the article images I’ve used with IDs.

Adi_matrix might be of help to change those entries.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#5 2012-12-12 22:07:03

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

Re: Using an articles images name instead of id

For future forum researches:
Linking to a topic in that several posters improved means of embedding images with their original file names for SEO reasons.


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

Offline

Board footer

Powered by FluxBB