| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | Mark Forums Read | User manuals | Login |
Take images OUT of the database - creating img hard copies | ||||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
Take images OUT of the database - creating img hard copies
This script will copy the images out of your database and make hard copies of them. Furthermore, it creates a thumbnail of each image for use on the category display pages.
This is helpful to those who want a faster load time and images cached for users among other things. Right now, the images are stored as BLOBs in the database. This is not always the most efficient way to store data. Enjoy! Call this file img_ext.php and place it in the root: Code:
The code above creates the images. Please note this code is for existing products. If you add more products, you either have to change the upload of the image or simply rerun the script. Then, in product.tpl, switch: Code:
to: Code:
And in products.tpl, switch: Code:
to: Code:
That should do it. You could delete the BLOB images out of the tables in the database to make it a lot lighter. This code is only for the main images, but can also be used for the detailed images, but that would also require changing some more code... If anyone needs to do that, let me know. |
|||||||
#2
|
|||||||
|
|||||||
cool code mike
__________________
ex x-cart guru |
|||||||
#3
|
|||||||
|
|||||||
Just a thought on this - it would be really great if x-cart had a configuration setting to say..store images in database Y/N?
rrf - future release maybe?? bearing in mind the amount of posts on this issue
__________________
ex x-cart guru |
|||||||
#4
|
|||||||
|
|||||||
Quote:
As I've already said somewhere on these forums, the new release (3.4.0) will have support for this configuration setting. |
|||||||
#5
|
|||||||||
|
|||||||||
__________________
Looking for a reliable X-cart host ? You wont go wrong with either of these. EWD Hosting Hands On Hosting |
|||||||||
#6
|
|||||||
|
|||||||
Script File
Mike,
Tried out your script and it worked perfect. Now, when I went and modified the products.tpl and product.tpl files is where I had the problem. After the modification, I received a parse error stating an error in products.tpl.php. Not sure what this meant so I went back to my original method for now until I can do some further testing on this. Is it possible this will not work with the latest version of Xcart? Mike... |
|||||||
#7
|
|||||||
|
|||||||
Quote:
Just seen that post...superb news
__________________
ex x-cart guru |
|||||||
#8
|
|||||||
|
|||||||
I just tested it with 3.3.2 and it works fine. Why don't you either post or pm me some of your code that you changed and I will take a look at it.
-Mike |
|||||||
#9
|
|||||||
|
|||||||
UserMike,
Thanks for your code, but maybe you could help me out with a slight problem in my attempts to modify your php script and both template tags to convert and call GIF images instead of JPEG images. In brief, I'm using X-Cart version 3.3.5 and my images are in GIF format (all have transparent backgrounds). I've modified the the original X-Cart templates to have 140 image widths for thumbnails and 560 widths for detailed images. Every thing works OK. But, I'd like to use your php script and template modifications for my GIF images. Unfortunately, I keep getting errors no matter what modifications I make to your script. In advance, that you for your time and consideration of my request! Sincerely, Jim |
|||||||
#10
|
|||||||
|
|||||||
Hmmmm....
I think I found part of "my problem" in that I had to manually create a "thumbs" directory within the images directory and then manually transfer the thubnail images into that directory. That seems to work OK for the thumbnail images. However, it appears that the larger Detailed Image is still being pulled from MySQL databse............... |
|||||||
|
Thread Tools | Search this Thread |
|
|
|
|||
X-Cart forums © 2001-2020
|