Topic: Dynamically renaming images used in <img> tags? (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=28032" title="Pages that link to Topic: Dynamically renaming images used in &amp;lt;img&amp;gt; tags? (Page 1 of 1)" rel="nofollow" >Topic: Dynamically renaming images used in &lt;img&gt; tags? <span class="small">(Page 1 of 1)</span>\

 
H][RO
Bipolar (III) Inmate

From: Australia
Insane since: Oct 2002

posted posted 06-04-2006 04:11

Hi All,

I have a smalll dilema just wondering the best way to handle it.

I have a database of images which stores an incremental index, and a custom name for each image.

The images them selves are stored on the server with the index... i.e image1.jpg image2.jpg etc...


What I want is some way to dynamically rename the images when they are viewed on a page, so rather than <img src="image1.jpg" /> it could be <img src="my image.jpg" />

The reason for this is so that images can be indexed ni search images like googles image search. While i would like to beleive it can somehow be done with php, i'm assuming its really a htaccess thing or somethign which is a pain ..


anyone have any good ideas?

Tyberius Prime
Maniac (V) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 06-04-2006 10:44

How about having a session, a single image.php... send the image name via the session, then only output that image.
But of course, that will fail if you have multiple images on a page.

I believe it's trivial to redirect all images[\d]+\.jpg to a php file - but how will you discern what image to send?!?
Wouldn't just a robots.txt excluding the image folder do what you want as well?

so long,

->Tyberius Prime

H][RO
Bipolar (III) Inmate

From: Australia
Insane since: Oct 2002

posted posted 06-04-2006 12:42

Hmm not sure what you mean by the robots.txt, how will that it what the image names are?

Its kind of an automated process with images always being added and stuff, i was thinking i could have the image src="image.php?id=1" kind of thing so i know what image to return, but that really doesnt help at all with the naming things.

Maybe its not that big a deal, the images have proper descriptions in the alt text, im not sure if google images refer to these or just the file name.

Tyberius Prime
Maniac (V) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 06-04-2006 14:59

Hopefully, you're placing all the images in one folder, then simple exclude that in robots.txt.

If not - start doing it - it's way simpler than any other method of blocking google images.

H][RO
Bipolar (III) Inmate

From: Australia
Insane since: Oct 2002

posted posted 06-05-2006 02:14

Sorry must have been a bit of confusion there!

Yeh they are all in one folder, but i dont want them blocked from gooogle images, i want them to show up in google images.

Beacause they are named image1, image2, image3 etc. I figure they may not show up..


E.g image1 is a picture of a glove, has an alt tag that says 'glove'. Im just not sure if it gets indexed for the word glove because the file is named something else.

HZR
Paranoid (IV) Inmate

From: Cold Sweden
Insane since: Jul 2002

posted posted 06-05-2006 12:18

Google certainly finds images based on the alt attribute value. See for example: http://www.tbray.org/ongoing/When/200x/2005/04/04/Cherries-Won

H][RO
Bipolar (III) Inmate

From: Australia
Insane since: Oct 2002

posted posted 06-05-2006 12:47

Awesome thanks..


On that note... are you supposed to use title tags for images? I didn't know it was an attribute of images as well as alt?

Or can you just put a title on absolutely anything?

Tyberius Prime
Maniac (V) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 06-05-2006 15:57

Ahh - I missunderstood you there.
If you want to have a clear another_name->some_image relation,
mod_rewrite, and possibly php would be the way to go.

But yeah, I wouldn't worry about it. Google images looks at more than just the image filename.


If I read the XHTML 1.0/transitional DTD right title can indeed be stuck on virtually anything.

H][RO
Bipolar (III) Inmate

From: Australia
Insane since: Oct 2002

posted posted 06-05-2006 16:23

Awesome, thanks for all the help folks.



Post Reply
 
Your User Name:
Your Password:
Login Options:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu