osCmax v2.5 User Manual
Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Too many images in the image directory

This is a discussion on Too many images in the image directory within the osCmax v2 Customization/Mods forums, part of the osCmax v2.0 Forums category; Is there a way of sorting the images in the image folder out so it will load faster and be ...

      
  1. #1
    osCMax Testing Team
    Join Date
    Jul 2008
    Posts
    19
    Rep Power
    0


    Red face Too many images in the image directory

    Is there a way of sorting the images in the image folder out so it will load faster and be more organized I have to many products and it doesn't want to load in filemanager.

  2. #2
    osCMax Development Team met00's Avatar
    Join Date
    Oct 2005
    Location
    wherever I happen to be at the moment
    Posts
    854
    Blog Entries
    2
    Rep Power
    26


    Default Re: Too many images in the image directory

    1) this is NOT and OSC problem
    2) I have about 25,000 images in the images directory with no problem
    3) If you really want to reduce the number of images in the directory - with just a bit of modification in the code on the admin side you can set a pulldown for a subdirectory structure in the image directory and then set the products to upload to the subdirectory you want. Or make it simpler - every time you create a new category it creates a subdirectory in the images directory for that category. Then when you upload an image it will place the image for that product into that categories subdirectory. Now your subdirectories will be limited in size to the number of products images in the categories.
    so endith the lesson
    <think>sometimes I just sit's and thinks</think>
    "Here you are with a hand full of holes, a thumb up your ass, and a big grin to pass the time of day with." - TWB

  3. #3
    osCMax Testing Team
    Join Date
    Mar 2008
    Posts
    12
    Rep Power
    0


    Default Re: Too many images in the image directory

    Sounds fairly easy but unfortunately I am not a php coder and have no clue where to even change the code to do this. Any advise on what files would need to be recoded to accomplish this would be greatly appreciated.

    Also, just for info, it is not when i am on the website that I am having a slow down. It is when I use file manager to access the images directory for anything. It takes the file manager page forever to load to my browser. Only in the images directory!


    PS The directory is so huge it even takes it forever to list the contents when I am directly logged onto the server machine and using the linux command line.
    Last edited by farcrowe; 07-23-2008 at 07:33 AM.

  4. #4
    osCMax Testing Team
    Join Date
    Jul 2008
    Posts
    19
    Rep Power
    0


    Default Re: Too many images in the image directory

    Wait wait wait your getting me confused...When I create the a new section of items I can specify a subdirectory in the image file without the use of any coding and it will find it? ....side note: I'm working on the same site as farcrowe.
    Last edited by Anomily; 07-23-2008 at 10:48 AM. Reason: more specific.

  5. #5
    osCMax Development Team met00's Avatar
    Join Date
    Oct 2005
    Location
    wherever I happen to be at the moment
    Posts
    854
    Blog Entries
    2
    Rep Power
    26


    Default Re: Too many images in the image directory

    Quote Originally Posted by Anomily View Post
    Wait wait wait your getting me confused...When I create the a new section of items I can specify a subdirectory in the image file without the use of any coding and it will find it? ....side note: I'm working on the same site as farcrowe.
    I was suggesting a contribution/mod to stock osc or oacmax.

    The mod would be in the admin area.

    1) when you create a category it would create that category in the /images directory
    2) when you upload an image it would put it into the correct category subdirectory auto-magically.

    the only problem is using mopics (you would have to know the path to upload the FTP extra images to). But it would be simple to print out the file path in the products page in the admin to overcome that issue.

    The next potential problem would be the need to handle duplication of products (unlinked) and how you would manage the images in that case (would you duplicate the image or just use the current reference?)

    It would be an interesting mod to make and offer to the community. And no, I don't need it so I am not going to write it up, but it wouldn't be too hard and maybe others would find it useful.
    so endith the lesson
    <think>sometimes I just sit's and thinks</think>
    "Here you are with a hand full of holes, a thumb up your ass, and a big grin to pass the time of day with." - TWB

  6. #6
    New Member
    Join Date
    Aug 2008
    Posts
    6
    Rep Power
    0


    Default Re: Too many images in the image directory

    Hi Met00,

    I'm using OSC RC2.2, the upload of files to the subdirectory via Admin control panel was successfull. But at the front end, the images not shown up. It still looking at 'images' directory. Not to 'images/somesubdir' . What must we change more ?

    Many thanks.
    Best Regards,
    - Jack -

  7. #7
    osCMax Development Team met00's Avatar
    Join Date
    Oct 2005
    Location
    wherever I happen to be at the moment
    Posts
    854
    Blog Entries
    2
    Rep Power
    26


    Default Re: Too many images in the image directory

    two possible solutions...

    1) use easypopulate.
    a) download the easypop file
    b) modify the image location to include the subdirectory in the path
    c) upload the file via easypopulate to change the database

    2) create a function called findimage
    a) create findimage function to take the unique image filename
    b) findimage($imagename) is called after any DB call where the image file is displayed (usually in the loop that goes through the returned values, except for the product detail where it would be right after the db call)
    c) add findimage function to the general php functions
    d) code the findimage function to transverse the image sub-structure looking for the file and then rewrite the $image value to the complete path
    [note that on a site that get 1000 vistors a day with an average pageview of 4 to 5 pages this could be an intensive process that may effect site speed and it is NOT recommended, but it is a possible solution)

    a third solution is a one time run (or run after every FTP, or once a month) from the admin that automates the process of adding the full path name to the database. In this case a program is run from the admin that will loop through every product, check for an image file, if there is none it will update the image to a generic noproductimage.jpg file and if it finds a file it will make sure that the full directory path to the image is in the database.

    I started with #1, easypopulate. As I hate to do data entry I moved to #3 to let the system do it for me. This is DB and CPU intensive so I don't run it unless I have made a large number of updates, and even then I run it late at night. It is a part of my month-end processing for the store (I have about 5 programs I run that clean up the product database at the end of every month. Some use text files to update pricing and cost information, some change items from standard order to special order in the database based on information from my distributors that are in an uploaded text file, etc.)

    When you are working with in excess of 20,000 items you have to look at a store a bit differently as it is impossible to hand maintain the database (even with the great OscMAX backend). Thus a store of that size must move to a method that can process text files (generated from spreadsheets, data feeds, etc) to the database. Easypopulate is a great example of how to build such fine tuned programs to fit your needs and add them under the admin->tools menu.
    so endith the lesson
    <think>sometimes I just sit's and thinks</think>
    "Here you are with a hand full of holes, a thumb up your ass, and a big grin to pass the time of day with." - TWB

  8. #8
    New Member
    Join Date
    Aug 2008
    Posts
    6
    Rep Power
    0


    Default Re: Too many images in the image directory

    Hi Met00,

    Many thanks for your quick reply and your tips
    Very nice ... And now I have some more questions

    1) I tried to download Easypopulate, but which one ? The last one is the Documentation dated 10 Aug 2008, shall I also get the other one dated 29 Jul 2008 (EP 2.76g) by web28 ?

    2) Solution number 3, is it included in Admin Control panel, or we must create a / some scripts for the automation process ? Can we find these scripts in internet?

    Thanks before.
    Best Regards,
    - Jack -

  9. #9
    osCMax Development Team met00's Avatar
    Join Date
    Oct 2005
    Location
    wherever I happen to be at the moment
    Posts
    854
    Blog Entries
    2
    Rep Power
    26


    Default Re: Too many images in the image directory

    1) easypopulate comes with OscMAX, it's built in.
    2) I write these myself and add them to the tools area of the admin. You can't find them on the Internet since the script has to know the format of the OSC database and generally these are only built as needed (and people that build things like these are generally tweaking their own stores). You can find a bunch of samples to do stuff (like a script that will transverse a directory structure and return a path to a specific file) that you can string together to create your script. for instance, the code for transversing a directory can be found in this thread Read Sub folder - Sub directory but you would gave to tweak it a bit to your purposes... then you would have to add the code to get the filename from the table and then insert the filename with full path into the table... so the code is there, but not complete for you.
    so endith the lesson
    <think>sometimes I just sit's and thinks</think>
    "Here you are with a hand full of holes, a thumb up your ass, and a big grin to pass the time of day with." - TWB

  10. #10
    New Member
    Join Date
    Aug 2008
    Posts
    6
    Rep Power
    0


    Default Re: Too many images in the image directory

    Hi Met00,

    Many thanks again for your tips
    I'll see the URL link you gave me. Btw, osc max is better than oscommerce ?
    (I mean, all features of OSC are included in OscMAX ?)
    I'm new to OSC .... so if OscMax is better, can I direct jump to OscMax without playing with OSC native first ?

    Thanks.
    Best Regards,
    - Jack -

Page 1 of 2 12 LastLast

Similar Threads

  1. Changing default /images directory
    By MindTwist in forum osCmax v2 Customization/Mods
    Replies: 8
    Last Post: 08-30-2007, 02:31 AM
  2. Separate directory for product images
    By Twister in forum osCmax v2 Customization/Mods
    Replies: 0
    Last Post: 06-15-2007, 03:03 AM
  3. Image directory protection
    By php4ever in forum General Topics & Chit Chat
    Replies: 4
    Last Post: 06-07-2007, 07:06 PM
  4. categorising image directory
    By krazyworld in forum osCommerce 2.2 Modification Help
    Replies: 0
    Last Post: 08-18-2005, 02:26 PM
  5. Error: Catalog images directory is not writeable:
    By shellarts in forum osCommerce 2.2 Installation Help
    Replies: 2
    Last Post: 06-07-2005, 06:32 PM

Tags for this Thread

Bookmarks

Posting Permissions

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