| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Images breaking after host and/or directory change | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||||
|
|||||||||
Images breaking after host and/or directory change
Only Tested with X-Cart 4.0.18. (and only applies if you use File System Images Location).
Tired of writing in forced changes to func_get_thumbnail_url() so that the string manipulations would fire off the if condition to return the proper file instead of using images.php. This ALWAYS seems to happen when at any time the full local path (ie. /home/user/public_html/xcart/) changed in some way. Making file system images break. This script ran once will replace any string you need (via eregi_replace so regular expressions are valid) to help force X-Cart to start using the FS again. PHP Code:
I know its good idea to dump to DB before changing local paths, then back out to the FS via Images Location. But I hate using a database for a file system, its just not, and shouldn't be used for such. Not to mention I was having issues using this method in previous experiences it wasn't very solid fix for me, and I would still end up hardsetting $xcart_dir in func_get_thumbnail_url(). Doing this also causes your filenames to wiped, and X-Cart generates new ones once you convert back to FS. Hopefully FULL paths aren't stored in later versions of X-Cart, a relative path to the X-Cart directory would be enough, don't ya think
__________________
Cart-Lab - 100+ Social Bookmarks for X-Cart. |
|||||||||
#2
|
|||||||
|
|||||||
Image broke on my upgrade test installation (direct copy of my current version). Going to give this a try (will post back with results).
EDIT: What I did was create a duplicate of my original x-cart installation and MySQL DB. Then I put it in a subdirectory and created another DB. This second set of DB / web content is pretty much the same with the only difference being in config.php and that I upgraded it from v4.0.18 to v4.0.19. The images are of course broken and at first I thought that would be natural but these images have full path to the image location and the images at the original location are still there (there's even a copy of those images in the copy installation as well). Now why would the images break still? EDIT: Just ran a test. Let's say : Originally I had : /usr/home/xcart/images/abc123.gif (same as in my copy installation) in the DB (images stored in FS) However, the copy installation will not display the images. So I change it to : /usr/home/xcart/upgraded/images/abc123.gif and magically it works. My conclusion is that X-Cart appends something that makes it fail to reach the image even though it asked for a full path. Still doesn't explain a whole lot. EDIT: Not being all that familiar with regular expressions. Let's say I moved it into a sub-directory. From /usr/home/xcart/ To /usr/home/xcart/upgraded/ I should have: $pattern = "\/xcart"; $replace = "/xcart/upgraded"; Is that assumption correct?
__________________
4.1.8 |
|||||||
#3
|
|||||||||
|
|||||||||
Quote:
Yes, you are correct. /xcart would become /xcart/upgraded. Of course this will append both leading and trailing content as well. If your not too familiar with regular expressions: http://weitz.de/regex-coach/ You also correct in assuming x-cart does a string compare for the full path, within the func_get_thumbnail_url function in include/func.php using $xcart_dir. (4.0.x) Code:
Code:
__________________
Cart-Lab - 100+ Social Bookmarks for X-Cart. |
|||||||||
#4
|
|||||||
|
|||||||
Re: Images breaking after host and/or directory change
Great little script, thank you.
__________________
X-cart: 4.0.17 PHP: 4.3.11 |
|||||||
|
|||
X-Cart forums © 2001-2020
|