Reputation: 278
In oscommerce, I have set the DIR_WS_IMAGES from the config.php to be an external url so that the site loads the images from a static cookie-less subdomain.
The images work fine except the pop-us.
The pop-up scritp echo osc_link_object(osc_href_link(DIR_WS_IMAGES.
will give the following url http://www.example.com/http://subdomain.example.com/products/originals/image.jpg which will not function as its calling main url plus the DIR_WS_IMAGES url.
How can I amend the script to just call subdomain.excample.com
Thanks for any help.
Regs Fabian
This is the code that is giving a double url [http://www.example.com/http://subdomain.example.com] that needs to be corrected to output just the [http://subdomian.example.com]
<?php
$group_id = $osC_Image->getID('originals');
echo osc_link_object(osc_href_link(DIR_WS_IMAGES.'products/'.$osC_Image->getCode($group_id).'/'.$osC_Product->getImage(),null,'AUTO',false), $osC_Image->show($osC_Product->getImage(), $osC_Product->getTitle(), null, 'product_info'), 'target="_blank" rel=""');?>
Appreciate all the help.
Regs Fab
Upvotes: 0
Views: 476
Reputation: 278
I have managed to correct the problem by simply doing
osc_link_object($link = DIR_WS_IMAGES.('products/'....
instead of
echo osc_link_object(osc_href_link(DIR_WS_IMAGES.'products/'....
Upvotes: 0
Reputation: 26
May be this post can help you a bit. http://developerblog.e-cart-solutions.com/2010/10/product-images-images-from-remote-locations/ You can simply restort to replacing the domainname by the sudomain name if the paths are no different using a simple str_replace.
Shiva
Upvotes: 0
Reputation: 490567
Quickest and easiest thing to do (and won't look so out of place in osCommerce's code) is to do a preg_replace()
.
echo str_replace('/^http:\/\/www\.example\.com\//', '', osc_link_object(osc_href_link(DIR_WS_IMAGES.'whatever.jpg')));
Even better, dig out the global constant from includes/config.php
and concatenate it in the regex - be sure to use preg_quote(SITE_BASE, '/')
(assuming SITE_BASE
is it, can't think of it right now off the top of my head).
Upvotes: 0