Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Repair Article Images
I’ve just noticed that a number of images from older articles are no longer displaying.
In the articles I have <img src=“images/…… instead of the full URL <img src=“http://www.the-rock-of-gibraltar.com/images/ which I have been using more recently.
Obviously the images displayed correctly when the articles were first published.
Have I changed something in TXP or has TXP changed so it now needs the full URL?
Either way I wondered if Stef or some pattern matching whizz could help me out?
Thanks
Geoff
Edit … I used to use Hak Tinymce to insert images until 4.2.0 when I remember I had problems … would this be the reason?
Last edited by geoff777 (2010-04-06 16:10:28)
There are 10 types of people in the world: those who understand binary, and those who don’t.
Offline
Re: Repair Article Images
geoff777 wrote:
Have I changed something in TXP or has TXP changed so it now needs the full URL?
I don’t think so. Depends how far you’ve upgraded or if you’ve moved the site from, say, a sub-dir install to a root domain. images/img-name.jpg
may not resolve to the correct URL in certain circumstances that are probably host-related.
Couple of approaches I can think of to fix this:
- an .htaccess rule to rewrite
images/img-name
to/images/img-name
(don’t ask me for the rule… I’m a complete tool at htaccess stuff!) - A mass update on your textpattern table to replace
img src="images/"
withimg src="/images/"
in the Body and Body_html columns — I can help with that if you get stuck
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
#3 2010-04-06 16:58:12
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Repair Article Images
Plugin: lam_search_replace
Offline
Re: Repair Article Images
Thanks, Stef, Els
don’t think so. Depends how far you’ve upgraded or if you’ve moved the site from, say, a sub-dir install to a root domain. images/img-name.jpg may not resolve to the correct URL in certain circumstances that are probably host-related.
I’ve upgraded from 4.0.8 to 4.2.0
Yes I have changed host.
I’ve just tried lam_search_replace – thanks Els, but I’m afraid it didn’t work.
When the plugin reports it changed 0 occurrences there’s an image not found placeholder which resolves to
'</strong>%20were%20found.</td></tr><tr><td%20colspan=
I don’t think it likes searching and replacing html tags?
I often thought a replace function on Stef’s “Where Used” plugin would be very useful.
I’d guessed it wasn’t included because it could cause havoc if not used properly.
Last edited by geoff777 (2010-04-06 19:47:20)
There are 10 types of people in the world: those who understand binary, and those who don’t.
Offline
#5 2010-04-06 21:02:35
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Repair Article Images
I can’t help you with the actual MySQL query, but I just thought of a possible temporary solution; if it works you could use it until you manage to change the db entries.
Using rah_replace, assuming that the img tags are in the article body, put this around the <txp:body />
tag:
<txp:rah_replace from='src="images/' to='src="/images/'>...</txp:rah_replace>
Not tested ;)
Edit: of course this only changes the output, not the actual db entry.
Last edited by els (2010-04-06 21:04:51)
Offline
Re: Repair Article Images
Hi Els
That worked!
Txp and these forums are fantastic.
Thanks again
There are 10 types of people in the world: those who understand binary, and those who don’t.
Offline
Pages: 1