How to change the cached file name suffix?

Hello,

I've been using ZenPhoto 1.2 since it's release. Now I upgraded to 1.2.9 and non of the previously cached images are not usable anymore. On my web site, I was hotlinking the cached image.

Previously, cached images were stored as like this:

image.jpg_600.jpg

Now, with 1.29, it's stored as:

image_600.jpg

I need to change the cached file name to the previous one. I found a function called cacheImage in functions-image.php but i can't see where I can change the suffix of the cached files.

Where can I change these settings.

Thanks.

Comments

  • acrylian Administrator, Developer
    You can't change the cache file names unless you also want to hack the core. Which is naturally not recommend for obvious reasons.

    Zenphoto generates cached files as needed, so you have to update the links to those images. Not the other way round.. But actually you should not link to cached files directly.
  • Hello acrylian, Thanks for super fast reply.

    I'm running a review site, which I hotlinked nearly 4K images :)

    It's OK for me to hack the core, If you can show me the appropiate files and functions. If not, I need to write a regex to change all the previous links in my articles :(
  • acrylian Administrator, Developer
    The file to look at is `zp-core/i.php`. There is bascially all image processing done. For the future I really would suggest not to use direct cache image links...
  • Hey acrylian, thanks for the heads up.
  • wongm Member
    Hacking the core is fine until a new version of Zenphoto comes out, then your changes will go bye bye (unless you much around with your own subversion repository branched from the Zenphoto core).

    Instead of linking directly to the cache, you can generate URLs that will point to zp-core/i.php which will regenerate cached images if required, otherwise you get the cached version.
    For instance this image link:
    http://wongm.railgeelong.com/vline-geelong/image/500/D170_7001.jpg
    Resolves to the cached image:
    http://wongm.railgeelong.com/cache/vline-geelong/D170_7001_500.jpg
    So if linking outside Zenhphoto, I use the first link, and a deleted cache is never an issue!

    Back to your problem, you can probably add some custom .htaccess rules to change image.jpg_600.jpg requests into image_600.jpg - I am not that good with regular expressions so someone else will have to help you out on that front.
Sign In or Register to comment.