Textpattern Forum

You are not logged in. Register | Login | Help

#1 2012-06-18 20:00:06

elwins
Member
From: Latvia
Registered: 2011-08-29
Posts: 80
Website

Images ID with images title

For better SEO, would be nice, if there is some way to get images with title in their name.
After I upload image in TXP admin panel it gets:

Example:

…/images/1.png
…/images/1t.png
…/images/97.png
…/images/97t.png

But for better SEO I need:

…/images/textpattern-logo-1.png
…/images/textpattern-logo-1t.png
…/images/waterfall-97.png
…/images/waterfall-97t.png

Is there some plugin, option or source code edition, to get this result?

Thanks!

Offline

#2 2012-06-18 20:04:11

maniqui
Moderator
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 2,967
Website

Re: Images ID with images title

Hi Elvis.

Check if the tips on this thread could help you:
http://forum.textpattern.com/viewtopic.php?id=36339


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#3 2012-06-19 13:28:32

elwins
Member
From: Latvia
Registered: 2011-08-29
Posts: 80
Website

Re: Images ID with images title

hmm, looks nice, but thats not solution for all content images, expeshally, when admin adding images to new articles…
TXP source making links witch isnt very good.

In TXP source files there are ‘.imagesrcurl($id, $ext).’ , best would be: ‘.imagesrcurl($name, $id, $ext).’
and output: ../images/name-id.ext

Offline

#4 2012-06-19 13:51:45

maniqui
Moderator
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 2,967
Website

Re: Images ID with images title

hmm, looks nice, but thats not solution for all content images, expeshally, when admin adding images to new articles…
TXP source making links witch isnt very good.

I assume you are talking about adding image directly in the body of the article (using Textile or plain HTML maybe) by hand, instead of doing it programatically as the thread suggested, right?
From a SEO POV, I’d say it could be very good (no proofs to my claims, anyway): each time the admin adds an image to the article body (again, using Textile or Plain HTML), he has the possibility of fine-tuning/optimizing the image name to a very specific set of keywords related to that very particular article. I.e: /images/123-my-article-title-and-this-keyword-too.jpg.
So he could do some SEO image trickery on a per-article & per-image basis.

If you or admin are really looking into squeezing some SEO juice from images, I’d suggest to try the above…

Anyway, just thinking aloud. What do you think?


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#5 2012-06-19 14:32:41

elwins
Member
From: Latvia
Registered: 2011-08-29
Posts: 80
Website

Re: Images ID with images title

I am near for nice result!
I am already made changes in ../textpattern/include/txp_image.php, and theese simply changes works great.
Next step is ../textpattern/lib/class.thumb.php, where need to give way, to images, by this new style, but my PHP knowledge isnt so good :/

In txp_image.php I have structure: .$id.'-'.$name. and .$id.'-t'.$name.

$name – file name and extension, whom I am uploading.

——

I am using TinyMce article formating.

Last edited by elwins (2012-06-19 14:35:41)

Offline

#6 2012-06-19 15:39:13

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,175
Website

Re: Images ID with images title

I’d say you’re going about it the wrong way. As Julián said, how are you needing to insert images to your site? Does TinyMce have an “Insert Image” button? That button could probably be changed to insert the code that would work with the .htaccess method in the tip.


My Plugins

Piwik Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#7 2012-06-19 15:47:01

elwins
Member
From: Latvia
Registered: 2011-08-29
Posts: 80
Website

Re: Images ID with images title

It have, but I need user friendly. Why should I use .htaccess file if there is way who takes less system resourses, and for fully working .htaccess file anyway would need main source editions.

Last edited by elwins (2012-06-19 15:47:57)

Offline

#8 2012-06-19 16:03:32

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 5,714
Website

Re: Images ID with images title

I concur with MattD that hacking the core is the wrong approach.

And I still don’t know what problem you are trying to overcome. You say you need it to be “user friendly”. What, exactly? The image upload process? Editing images from the admin side? The fact the destination URL contains a number instead of a name?

You say that the Txp admin panel shows the files as /images/42.jpg. Where, exactly do you see this list of image paths and filenames? In the Image list panel it shows the names and IDs (and thumbs) so you can click on the one you want. When you go and edit one, you see the salient database details. If you can show us where the usability problem lies in the admin panel, we can maybe address it.

One thing that’s been playing at the back of my mind is: what if there was a callback in imagesrcurl() which allowed a plugin to alter the filename / path? That’d get us 80% of the way and certainly cover all output bases. The only thing to worry about then is refactoring the code a bit to utilise the same (or very similar) callback inside wet_thumb() (in class.thumb.php) so that when images are first uploaded the filename can be altered by the same plugin into the desired format.

It’s pretty rudimentary and there are lots of edge cases. Like, for example, what happens if you alter the image name on the Images>Edit panel? At the moment it only changes the DB, but potentially the plugin would need to intercept the save request so it could (optionally) rename the actual file, if that’s what the author wished. I’m sure there are more and I haven’t really thought it through.

Instead of hacking the core and breaking years of backwards compatibility for what is, arguably, a niche feature request (I can count the number of times this has come up in the last six years on my toes), I’m open to the notion of allowing a plugin to weave its way into this part of the core’s fabric if we can do it in a safe and logical manner.

If anybody feels strongly about this, a patch is always welcome for consideration, but it’s not a core high priority at the moment (at least, not for me!)

Last edited by Bloke (2012-06-19 16:11:09)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern.

Txp Builders – finely-crafted code, design and Txp

Online

#9 2012-06-19 16:12:34

elwins
Member
From: Latvia
Registered: 2011-08-29
Posts: 80
Website

Re: Images ID with images title

Bloke wrote:

At the moment it only changes the DB, but potentially it’d need to be passed to the plugin so it could (optionally) rename the actual file.

After uploading Image, user cant change image name, anymore, this problem for now is resolved, for me.

Okey, if you say that, this way isnt best for me, then what you suggegst ?

Last edited by elwins (2012-06-19 16:15:40)

Offline

#10 2012-06-19 16:15:36

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 5,714
Website

Re: Images ID with images title

elwins wrote:

After uploading Image, user cant change image name

Well, they can edit the name in the database (which you can display where you like on the site).

Let’s start here: why do your users need to rename files after they are uploaded? What extra functionality / advantage does it give?


The smd plugin menagerie — for when you need one more gribble of power from Textpattern.

Txp Builders – finely-crafted code, design and Txp

Online

Board footer

Powered by FluxBB