Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    Join Date
    Sep 2005
    Location
    Waikato, New Zealand
    Posts
    1,539
    Plugin Contributions
    3

    Default Image Handler - Extra BMZ folders for GoDaddy (and other cheapie hosts) users mod.

    This is not the Image handler support thread, that is here

    This is for Image Handler users who are hosted by GoDaddy (and other bucket hosts) who are falling foul of Godaddys limit of 1024 files per folder rule in your bmz_cache subfolders, where the optimised images are placed by image handler.

    With most decent hosts you shouldn't need to do this as they don't have issues with you exceeding the 1024 files per folder.

    Anyway Here goes

    @ You Go Daddy users

    First off Image handler should be installed and working correctly, if it isn't working correctly in the first place, this won't fix it.

    This is an unsupported change to a core image handler file, which may help you Go-Daddy fans

    This hasn't been heavily tested so USE AT YOU OWN RISK
    , I make no guarantees whatsoever

    from line 71 in your
    /includes/functions/extra_functions/functions_bmz_io.php



    PHP Code:
    function getCacheName($data$ext='') {
      global 
    $bmzConf;

      
    $md5  md5($data);
      
    $file $bmzConf['cachedir'] . '/' $md5{0} . '/' $md5.$ext;
      
    io_makeFileDir($file);
      return 
    $file;

    try replacing it with this
    PHP Code:
    function getCacheName($data$ext='') {
      global 
    $bmzConf;

      
    $md5  md5($data);
    //  $file = $bmzConf['cachedir'] . '/' . $md5{0} . '/' . $md5.$ext;
      
    $file $bmzConf['cachedir'] . '/' substr($md5,0,2) . '/' $md5.$ext;
      
    io_makeFileDir($file);
      return 
    $file;

    Currently Image Handler uses the first character of the optimised image for the sub directory name in your bmz_cache folder, so you will have 16 sub folders 0-f (hexidecimal), The change above instead take the first 2 characters of the optimised image name giving you 256 subfolders in the bmz_cache, so this should mean less images in each folder.

    And just a note, there is no point trying to take the first 3 chars as that will give you 4096 folders which might kill the hamster that runs Go-Daddy
    Webzings Design
    Semi retired from Web Design

  2. #2
    Join Date
    Jun 2005
    Location
    Cumbria, UK
    Posts
    10,266
    Plugin Contributions
    3

    Default Re: Image Handler - Extra BMZ folders for GoDaddy (and other cheapie hosts) users mod

    Quote Originally Posted by nigelt74 View Post
    ...which might kill the hamster that runs Go-Daddy
    I didn't know GoDaddy has such as sophisticated system as this. Last I heard they we still using a shaduf.
    20 years a Zencart User

  3. #3
    Join Date
    Oct 2012
    Posts
    25
    Plugin Contributions
    0

    Default Re: Image Handler - Extra BMZ folders for GoDaddy (and other cheapie hosts) users mod

    Backed up the database and was about to try the code change on live site but had second thoughts. Not sure if this can be undone simply by replacing original code/php file or if will have effects on the rest of the site and database? By that I mean more "permanent" changes than just creating the 256 files which assume could be just deleted if issues occur.

    Going to try installing in my test cart as soon as I get some time. Test cart doesn't have Image Handler or the other plugins that live site has so have to take care of that first.

    Will post results here. Thanks again. If this works maybe they can give that hamster a little time off.

  4. #4
    Join Date
    Sep 2005
    Location
    Waikato, New Zealand
    Posts
    1,539
    Plugin Contributions
    3

    Default Re: Image Handler - Extra BMZ folders for GoDaddy (and other cheapie hosts) users mod

    This change has zero effect on the database, and the folders can be deleted if you so wish, you can either delete them manually or via Image Handlers Purge folders function.

    To undo the change simply revert the code, upload the file and then purge the folders and its all like it was before,
    Webzings Design
    Semi retired from Web Design

  5. #5
    Join Date
    Sep 2005
    Location
    Waikato, New Zealand
    Posts
    1,539
    Plugin Contributions
    3

    Default Re: Image Handler - Extra BMZ folders for GoDaddy (and other cheapie hosts) users mod

    This change has zero effect on the database, and the folders can be deleted if you so wish, you can either delete them manually or via Image Handlers Purge folders function.

    To undo the change simply revert the code, upload the file and then purge the folders and its all like it was before,
    Webzings Design
    Semi retired from Web Design

  6. #6
    Join Date
    Sep 2005
    Location
    Waikato, New Zealand
    Posts
    1,539
    Plugin Contributions
    3

    Default Re: Image Handler - Extra BMZ folders for GoDaddy (and other cheapie hosts) users mod

    In fact that point was so important i thought I'd say it twice.

    Stupid buttons
    Webzings Design
    Semi retired from Web Design

  7. #7
    Join Date
    Sep 2005
    Location
    Waikato, New Zealand
    Posts
    1,539
    Plugin Contributions
    3

    Default Re: Image Handler - Extra BMZ folders for GoDaddy (and other cheapie hosts) users mod

    Quote Originally Posted by schoolboy View Post
    I didn't know GoDaddy has such as sophisticated system as this. Last I heard they we still using a shaduf.
    Dunno where you heard that, a Shaduf would be a bit tooo technical wouldn't it


    Having said that, i do use Go-Daddy for all my .com domain registrations
    Webzings Design
    Semi retired from Web Design

  8. #8
    Join Date
    Oct 2012
    Posts
    25
    Plugin Contributions
    0

    Default Re: Image Handler - Extra BMZ folders for GoDaddy (and other cheapie hosts) users mod

    OK, finally got test cart pretty much set up the same way as live cart.

    I changed the code in TEST_CART/includes/functions/extra_functions/functions_bmz_io.php as suggested.

    At first result was blank pages at my test cart home page for a while and Server 500 errors but after a minute or so and refreshing the page eventually started to load. Checked the bmz_cache folder and still only 16 directories. all with one character filenames. Tried it a few more times, tried clearing cache in Image Handler Admin Tools, different browser, and a few other things but no change.

    Then I tried the code change on TEST_CART/MY_ADMIN/includes/functions/extra_functions/functions_bmz_io.php

    Result was lots of new directories in the bmz_cache folder all with two character filenames as expected. My test cart home page seems to be working fine and all images seem to load quickly.

    Wondering if I did something wrong? And should change the TEST_CART/includes/functions/extra_functions/functions_bmz_io.php back to the original file or just leave it as is?

    Thanks, Ed

  9. #9
    Join Date
    Oct 2012
    Posts
    25
    Plugin Contributions
    0

    Default Re: Image Handler - Extra BMZ folders for GoDaddy (and other cheapie hosts) users mod

    Update:

    I cleared the bmz_cache folder and then changed TEST_CART/includes/functions/extra_functions/functions_bmz_io.php back to the original unmodified file and instantly got page unavailable errors. A few minutes later was able to access the test cart home page again, checked the bmz_cache and saw it went back to 16 directories.

    There seems to be a certain period of time after you change the file where it takes the site offline. Changing the TEST_CART/MY_ADMIN/includes/functions/extra_functions/functions_bmz_io.php was apparently not necessary- waiting a little while is probably all that was needed.

    Replaced TEST_CART/includes/functions/extra_functions/functions_bmz_io.php with the modded file again and it's back to the way it was with the extra directories, everything seems to be working well.

    Am wondering if there is any reason to also change the TEST_CART/MY_ADMIN/includes/functions/extra_functions/functions_bmz_io.php to include the new code, and what exactly the file does in the MY_ADMIN folder?

  10. #10
    Join Date
    Sep 2005
    Location
    Waikato, New Zealand
    Posts
    1,539
    Plugin Contributions
    3

    Default Re: Image Handler - Extra BMZ folders for GoDaddy (and other cheapie hosts) users mod

    The delay must be a godaddy thing mine worked instantly, did you try accessing with a different browser? to eliminate cacheing issues
    Webzings Design
    Semi retired from Web Design

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v151 How to purge bmz cache folders automatically?
    By EdsGoodStuff in forum General Questions
    Replies: 7
    Last Post: 2 Jan 2013, 06:29 AM
  2. Bmz Cache - Image Handler
    By harry2cool in forum All Other Contributions/Addons
    Replies: 3
    Last Post: 30 Sep 2010, 07:45 PM
  3. image sub folders under large and medium folders
    By Sushigal in forum General Questions
    Replies: 2
    Last Post: 16 Apr 2009, 04:37 PM
  4. Any mod for a dynamic image handler?
    By gemohler in forum All Other Contributions/Addons
    Replies: 2
    Last Post: 18 Jan 2008, 05:03 PM
  5. extra images too small for image handler
    By jewelrylady in forum Customization from the Admin
    Replies: 10
    Last Post: 4 Jun 2006, 11:26 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg