2011-06-27 20:13:21

jakob
Moderator
omega
From: Germany
Known languages: en, de
Website

Re: Image name instead ID in html

Claire, if you’re on txp 4.30+, you should be able to replace all your txp:variables with txp:image_info so you end up with:

<txp:images category="galerie" break="" pageby="limit" limit="12">

  <a href="<txp:site_url />images/<txp:image_info type="id" />/<txp:image_info type="name" />" 
     title="<txp:image_info type="caption" />" 
     rel="lightbox-galerie">
    <img width="<txp:image_info type="thumb_w" />" 
         height="<txp:image_info type="thumb_h" />" 
         title="<txp:image_info type="caption" />" 
         alt="<txp:image_info type="alt" />" 
         src="<txp:site_url />images/<txp:image_info type="id" />t/<txp:image_info type="name" />" />
  </a>

</txp:images>

TXP Builders – finely-crafted code, design and txp

Offline

 

2011-06-27 20:53:02

CeBe
Plugin Author
êta
Real name: Claire
From: Caen - Fr
Known languages: fr: rwx, en: rw+ ; de: ro ; php, sql: wo :)
Website

Re: Image name instead ID in html

jakob a écrit:

you should be able to replace all your txp:variables with txp:image_info

Ah, yes ! That was the clever thing I’ve been looking for :)
Works perfectly, thank you !

Offline

 

2012-03-12 22:00:48

kvnmcwebn
Member
xi
Real name: Kevin
From: Ireland
Known languages: english
Website

Re: Image name instead ID in html

Hi this is really great.
I have a question about nested folders inside the images folder.
I’m using fpx image import to batch upload and automatically generate categories.
So the folder structure is like this:

images > import > category
Is there a way i can modify the images folder htaccess file so that it works with the nested folders.
Thanks a mill


its a bad hen that wont scratch itself.
photogallery

Offline

 

2012-03-12 23:54:04

MattD
Plugin Author
sigma
Real name: Matt Davis
From: Monterey, California
Website

Re: Image name instead ID in html

I thought fpx image import moved the files to the images directory.


My Plugins

In a way, each of us has an El Guapo to face. -Lucky Day (Three Amigos)

Offline

 

2012-03-13 02:06:28

kvnmcwebn
Member
xi
Real name: Kevin
From: Ireland
Known languages: english
Website

Re: Image name instead ID in html

hi matt. you’re right… sorry. not sure what the problem is then… I will take another look at.


its a bad hen that wont scratch itself.
photogallery

Offline

 

2012-03-13 23:42:31

kvnmcwebn
Member
xi
Real name: Kevin
From: Ireland
Known languages: english
Website

Re: Image name instead ID in html

ah awesome working now. I’m just outputting a simple list of images like this:

<txp:images category="sligo" break="" wraptag="ul" sort="id asc"  >
<li class="imagelist" >  
<img title="<txp:image_info type="caption" />" alt="<txp:image_info type="alt" />" 
src="<txp:site_url />images/<txp:image_info type="id" />/<txp:image_info type="name" />" /></li>
<li class="imageinfo"><txp:image_info type="caption" /></li>
</txp:images>

That is in an article. Now that I look at it I guess it should be more like this.

<txp:images category="sligo" break="li" wraptag="ul" sort="id asc" form="imagelist" />

Even that seems like it shouldn’t be in an article…

Anyway I’m going to switch the main gallery of my photo blog over to this now. It is a modified version of the widescreen template so it uses a custom field instead of the article image field. The custom field has the same image id/function as an article image would. I know it’s a long shot but is there a way i could get away with still using the custom field instead of an article image within the images tag. There are hundreds of articles to change over so I thought i would ask first.

Here is the existing form:

<li><a href="<txp:permlink />" title="<txp:title />">
<img src="<txp:site_url />
images/<txp:custom_field name="Image-ID" />t.jpg" 
alt="Thumbnail of <txp:title />" /></a>

thanks

Last edited by kvnmcwebn (2012-03-13 23:46:45)


its a bad hen that wont scratch itself.
photogallery

Offline

 

2012-05-04 15:01:30

maniqui
Moderator
omega
Real name: Julián
From: Buenos Aires, Argentina
Known languages: es,en

Re: Image name instead ID in html

This is an improved (I think!) version of the .htaccess trick that works well with smd_thumbnail (which creates subfolders to store images for each thumbnail profile).

I recommend to put this in an .htaccess file inside the your images folder. This way, by not putting it on your general .htaccess (the one at the root of your website), you avoid the rules being run on every request.

RewriteEngine On

# Uncomment one of the following lines in GoDaddy (depending from where you are serving images)
#RewriteBase /images/
#RewriteBase /static/images/

# Matches any URL of the kind /images/123/string.jpg and rewrites it internally to /images/123.jpg
RewriteRule ^([0-9]+)/(.+)(png|gif|jpg|bmp)$ $1.$3 [NC,L]

# Similarly to the above one, but this one matches those URLS that are in a subfolder like: /images/square/123/string.jpg 
# and rewrites them to /images/square/123.jpg
RewriteRule ^([^/]+)/([0-9]+)/(.+)(png|gif|jpg|bmp)$ $1/$2.$4 [NC,L]

I couldn’t find a way to merge the two rewrite rules into one, maybe someone clever than me could take it to that next level…


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

 

Powered by FluxBB