Hi guys,
I'm struggling coming up with something to edit images' paths. What I want is to basically use a PHP function on images embedded in posts, so when outputted instead of looking like this:
<img src="/images/path_to_my_image.jpg" alt="Ryan's GobLog, a blog about video games" />
... they'd look like this:
<img src="<?php auto_version('/images/path_to_my_image.jpg'); ?>" alt="Ryan's GobLog, a blog about video games" />
This function then looks at the image's UNIX timestamp, adds it to the URL, and then outputs it. A htaccess does the rest.
However, actually achieving this is proving much tricker than I thought. I simply can't do it! :( If anyone can think of a way I could do this it'd really help me out.
I've written a basic plugin that filters TinyMCE's XHTML-broken code into compliant stuff, but that didn't have any significant variation. Because the paths change each time I just can't work out how to do this.
If you're curious about my motives, it's so I can apply this technique to images:
http://particletree.com/notebook/automatically-version-your-css-and-javascript-files/
I've already got it working on my blog's header image, but that's only because I can stick the PHP straight into the template files.