Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

MaxCDN Content Delivery Solution?

 
Reply
   X-Cart forums > X-Cart 4 > Third Party Add-Ons for X-Cart 4
 
Thread Tools
  #21  
Old 10-05-2010, 08:24 AM
  Jon's Avatar 
Jon Jon is offline
 

X-Guru
  
Join Date: Oct 2002
Location: Vancouver, Canada
Posts: 4,200
 

Default Re: MaxCDN Content Delivery Solution?

On our 4.1.x here's how we did our thumbnail and product images.

Open include/func/func.files.php

FIND:

Code:
if (!strncmp($xcart_dir, $image_path, strlen($xcart_dir)) && @file_exists($image_path)) {

BEFORE add:

Code:
// WCM - CDN Images if (($type == 'T' OR $type == 'P') AND $_SERVER['HTTPS'] != 'on') return str_replace('/home/path/to/your/images/','http://cdn.example.com/',$image_path); // / WCM - CDN Images
Reply With Quote
  #22  
Old 11-02-2010, 01:46 AM
 
Stizerg Stizerg is offline
 

Senior Member
  
Join Date: Apr 2008
Location: Sydney, Australia
Posts: 195
 

Default Re: MaxCDN Content Delivery Solution?

Hi Jon!
I tried your code, but as result I get replaced url appended to mydomainname.
It looks like: 'http://www.mydomainname.com/http://cdn.example.com/'

Any idea?
__________________
X-Cart Gold Plus 4.6.6
A lot of custom mods
Reply With Quote
  #23  
Old 11-05-2010, 06:37 AM
  Jon's Avatar 
Jon Jon is offline
 

X-Guru
  
Join Date: Oct 2002
Location: Vancouver, Canada
Posts: 4,200
 

Default Re: MaxCDN Content Delivery Solution?

Try:

// WCM - CDN Images
if (($type == 'T' OR $type == 'P') AND $_SERVER['HTTPS'] != 'on')
{
$image_path = str_replace('/home/path/to/your/images/','',$image_path);
return str_replace('$http_location','',$image_path);
}
// / WCM - CDN Images
Reply With Quote
  #24  
Old 11-05-2010, 03:33 PM
 
Stizerg Stizerg is offline
 

Senior Member
  
Join Date: Apr 2008
Location: Sydney, Australia
Posts: 195
 

Default Re: MaxCDN Content Delivery Solution?

Brilliant! Thanks Jon.
__________________
X-Cart Gold Plus 4.6.6
A lot of custom mods
Reply With Quote
  #25  
Old 11-25-2010, 06:18 PM
 
swijaya0101 swijaya0101 is offline
 

Advanced Member
  
Join Date: Mar 2003
Posts: 52
 

Default Re: MaxCDN Content Delivery Solution?

It doesnt work. All images are blank.

// WCM - CDN Images
if (($type == 'T' OR $type == 'P') AND $_SERVER['HTTPS'] != 'on')
{
$image_path = str_replace('/home/mydomain/public_html/images/','',$image_path);
return str_replace('$http_location','',$image_path);
}
// / WCM - CDN Images

Anywhere I should add my cdn URL?
__________________
x-cart 4.1.10
Reply With Quote
  #26  
Old 11-25-2010, 09:34 PM
 
Stizerg Stizerg is offline
 

Senior Member
  
Join Date: Apr 2008
Location: Sydney, Australia
Posts: 195
 

Default Re: MaxCDN Content Delivery Solution?

Yes, you shoud

// WCM - CDN Images
if (($type == 'T' OR $type == 'P') AND $_SERVER['HTTPS'] != 'on')
{
$image_path = str_replace('/home/mydomain/public_html/images/','your_cdn_address',$image_path);
return str_replace('$http_location','',$image_path);
}
// / WCM - CDN Images
__________________
X-Cart Gold Plus 4.6.6
A lot of custom mods
Reply With Quote
  #27  
Old 12-29-2010, 09:56 PM
 
erone123 erone123 is offline
 

Newbie
  
Join Date: Mar 2005
Posts: 2
 

Default MaxCDN Content Delivery Solution?

Thanks I tried it out about a month ago and it seems to be working quite well.

On our 4.1.x I did notice one thing:
1 - The Detail Images are not being cached, so I added "OR $type == 'D'" and My server load went way up it was hitting
Last 1 minute 5.68
Last 5 minutes 17.62
Last 15 minutes 24.81

Below is the Code I used, Not sure what to do next?

#// include/func/func.files.php - WCM - CDN Product Images
if (($type == 'T' OR $type == 'D' OR $type == 'P') AND $_SERVER['HTTPS'] != 'on')
{
$image_path = str_replace('/var/www/vhosts/mysite/httpdocs/images/','http://netdna.mysite.com/images/',$image_path);
return str_replace('$http_location','',$image_path);
}
#// / WCM - CDN Product Images

Any suggestions?
__________________
Version 4.1.X

Last edited by erone123 : 12-29-2010 at 09:57 PM. Reason: grammer
Reply With Quote
  #28  
Old 12-29-2010, 11:12 PM
 
Stizerg Stizerg is offline
 

Senior Member
  
Join Date: Apr 2008
Location: Sydney, Australia
Posts: 195
 

Default Re: MaxCDN Content Delivery Solution?

Sorry, I didn't get it. What's wrong?
__________________
X-Cart Gold Plus 4.6.6
A lot of custom mods
Reply With Quote
  #29  
Old 12-31-2010, 08:36 AM
 
erone123 erone123 is offline
 

Newbie
  
Join Date: Mar 2005
Posts: 2
 

Default Re: MaxCDN Content Delivery Solution?

The detail images are being cached by MaxCDN,when I added "OR $type == 'D'" to your code Below is the example.
(($type == 'T' OR $type == 'D' OR $type == 'P') AND $_SERVER['HTTPS'] != 'on')

When I added this my server load goes high which makes the website really slow or time out.

How do I get the Detail images $type == 'D' to work with with your code with out getting the high server load or time out.
Reply With Quote
  #30  
Old 01-01-2011, 04:16 PM
 
Stizerg Stizerg is offline
 

Senior Member
  
Join Date: Apr 2008
Location: Sydney, Australia
Posts: 195
 

Default Re: MaxCDN Content Delivery Solution?

Can you make a screenshot of FireBug's 'Net' tab?

Normally it should not happen, becouse this code only replace image address. Is there any other modifications related to detailed images?
__________________
X-Cart Gold Plus 4.6.6
A lot of custom mods
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Third Party Add-Ons for X-Cart 4



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 06:55 PM.

   

 
X-Cart forums © 2001-2020