Timthumb.php cache directory location problem

Discussion in 'PHP' started by Matt18, Dec 12, 2011.

  1. #1
    Hello

    I am using timthumb.php on some of my webstores that are located on different domains for different languages. I sell the same products on all domains and therefore images are also the same. At the moment, I have cache directory located in the same directory as my timthumb.php script separated for each domain.

    define ('DIRECTORY_CACHE', './cache'); // cache directory

    So every domain has it’s own cache directory, which has more or less the same content on all sites. What I’d like to do is move the cache directory to the account root level so that all domains would be using the same cache folder to store cache files.

    I hope that that way I will have only one cached version for every image and that same cached image will be used on all domains. Will this work? How should I set:

    define ('DIRECTORY_CACHE', './cache'); // cache directory

    , to be 4 levels above the current position? Any comments on that solution?

    Thank you all for your help!
     
    Matt18, Dec 12, 2011 IP
  2. mfscripts

    mfscripts Banned

    Messages:
    319
    Likes Received:
    4
    Best Answers:
    8
    Trophy Points:
    90
    Digital Goods:
    3
    #2
    If they're on the same server (and safemode, permissions permitting), you could try this for a shared location 2 levels up:

    define ('DIRECTORY_CACHE', '../../cache'); // cache directory
    PHP:
    Alternatively you may be able to use the full server path:

    define ('DIRECTORY_CACHE', '/home/shared_cache/cache'); // cache directory
    PHP:
     
    mfscripts, Dec 12, 2011 IP
  3. Matt18

    Matt18 Guest

    Messages:
    591
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I tired both. And it doesn't work.

    But here is the funny part. It does create cache images inside cache folder, it just doesn't show the images on the page...

    Any ideas why is that?

    Edit: Update! It seems to work great on all levels, but the moment I go one level up from domain.com folder it doesn't show pictures anymore. It must be some problem with calling images from the cache folder, if the cache folder is not located on the same domain... Any suggestions please? :(
     
    Last edited: Dec 12, 2011
    Matt18, Dec 12, 2011 IP