I would like to switch image delivery from the main server to a subdomain (ex: images.mysite.com).
I changed the path in config.php and admin/config.php, but it made no difference, except breaking the thumbnails in admin.
What step(s) am I missing in order to shift all the image resources to a subdomain?
Or if anyone has a step-by-step guide, it would be much appreciated.
I'm on a great host with every option under the sun, so I can make any CNAME, subdomain, actual domain, etc, changes.
I changed the path in config.php and admin/config.php, but it made no difference, except breaking the thumbnails in admin.
What step(s) am I missing in order to shift all the image resources to a subdomain?
Or if anyone has a step-by-step guide, it would be much appreciated.
I'm on a great host with every option under the sun, so I can make any CNAME, subdomain, actual domain, etc, changes.
What version are you using? In 1.4.x I replaced:
/index.php
with
Then configured the subdomain on the host.
/index.php
Code: Select all
define('HTTP_IMAGE', HTTP_SERVER . 'image/');
Code: Select all
define('HTTP_IMAGE', str_replace('http://', 'http://image.', HTTP_SERVER));
-Ryan
How can I implement this in v1.5. Thanksrph wrote:What version are you using? In 1.4.x I replaced:
/index.phpwithCode: Select all
define('HTTP_IMAGE', HTTP_SERVER . 'image/');
Then configured the subdomain on the host.Code: Select all
define('HTTP_IMAGE', str_replace('http://', 'http://image.', HTTP_SERVER));
You should be able to just change
to
where "youstore.com" is your domain and "image" is the appropriate sub-domain (the sub-domain should point to OpenCart's regular image dir).
I believe that browsers and net standards have shifted in the last several months so that such setups are no longer considered CDNs though.
Code: Select all
define('HTTP_IMAGE', 'http://yourstore.com/');
Code: Select all
define('HTTP_IMAGE', 'http://image.yourstore.com/');
I believe that browsers and net standards have shifted in the last several months so that such setups are no longer considered CDNs though.
-Ryan
I don't know that it's considered a CDN, however, it does speed up page load times. Subdomains are treated like separate domains, so they will load the images as if it's external. Here's a tutorial on it:
http://www.inmotionhosting.com/support/ ... n-opencart
http://www.inmotionhosting.com/support/ ... n-opencart
Tim S
OpenCart Tutorials
vQmod Extension to remove "Powered By" in Footer
I understand that still do not display img?
Oferujemy kartony klapowe w dobrej cenie. Opakowania tekturowe dla ciebie.
I'm perfectly aware of that. If you look at Google Page Speed or WebPageTest.org you'll see they no longer stress this like they once did as the way modern browsers work has changed and there now exists more advanced methods of parallelization.tim_s wrote:I don't know that it's considered a CDN, however, it does speed up page load times. Subdomains are treated like separate domains, so they will load the images as if it's external. Here's a tutorial on it:
http://www.inmotionhosting.com/support/ ... n-opencart
-Ryan
I have done this already but this only works if the subdomain is in the same server as the core files and DB. However if the subdomain is hosted somewhere else does not work. I wonder what needs to be changed for this to work.rph wrote:You should be able to just change
toCode: Select all
define('HTTP_IMAGE', 'http://yourstore.com/');
where "youstore.com" is your domain and "image" is the appropriate sub-domain (the sub-domain should point to OpenCart's regular image dir).Code: Select all
define('HTTP_IMAGE', 'http://image.yourstore.com/');
Search the forum. I believe someone posted instructions on how to modify .htaccess to use external images. You'll have to create all the different image sizes manually since OpenCart isn't designed for doing this.
-Ryan
I have searched but no clear answers found so far. Whats the post title so I can find it ?rph wrote:Search the forum. I believe someone posted instructions on how to modify .htaccess to use external images. You'll have to create all the different image sizes manually since OpenCart isn't designed for doing this.
I dont think you can re-size the image size with htaccess I think its more like to be done on image.php
Don't remember what it was called. You'll just have to try searching under different terms.
Am I talking to myself here? Like I said, OpenCart cannot handle doing this. You will have to manually resize, rename, and upload all your image files. The only thing that can be easily done is the redirect.I dont think you can re-size the image size with htaccess I think its more like to be done on image.php
-Ryan
This file basically controls the image resize so I wonder if I modify it here.
catalog/model/tool/image.php
catalog/model/tool/image.php
Code: Select all
<?php
class ModelToolImage extends Model {
public function resize($filename, $width, $height) {
if (!file_exists(DIR_IMAGE . $filename) || !is_file(DIR_IMAGE . $filename)) {
return;
}
$info = pathinfo($filename);
$extension = $info['extension'];
$old_image = $filename;
$new_image = 'cache/' . substr($filename, 0, strrpos($filename, '.')) . '-' . $width . 'x' . $height . '.' . $extension;
if (!file_exists(DIR_IMAGE . $new_image) || (filemtime(DIR_IMAGE . $old_image) > filemtime(DIR_IMAGE . $new_image))) {
$path = '';
$directories = explode('/', dirname(str_replace('../', '', $new_image)));
foreach ($directories as $directory) {
$path = $path . '/' . $directory;
if (!file_exists(DIR_IMAGE . $path)) {
@mkdir(DIR_IMAGE . $path, 0777);
}
}
$image = new Image(DIR_IMAGE . $old_image);
$image->resize($width, $height);
$image->save(DIR_IMAGE . $new_image);
}
if (isset($this->request->server['HTTPS']) && (($this->request->server['HTTPS'] == 'on') || ($this->request->server['HTTPS'] == '1'))) {
return HTTPS_IMAGE . $new_image;
} else {
return HTTP_IMAGE . $new_image;
}
}
}
?>
Yes, I know what it does. I've been working with OpenCart since the 0.x days. And no, messing around with that is not going to get OpenCart interfacing and uploading to a third-party image server. You'll have to hire a developer because this is not something simple to do.
-Ryan
I have this tutorial:
http://forum.opencart.com/viewtopic.php?f=138&t=40573
But although it is recommended to use a subdomain for images.. it isn't considered a "CDN" since its on the same domain. Due to the way images are auto resized locally, external hosting doesn't really work at this time.
http://forum.opencart.com/viewtopic.php?f=138&t=40573
But although it is recommended to use a subdomain for images.. it isn't considered a "CDN" since its on the same domain. Due to the way images are auto resized locally, external hosting doesn't really work at this time.
I've done that already but like you said it cant be done done unless its on the same local server.Qphoria wrote:I have this tutorial:
http://forum.opencart.com/viewtopic.php?f=138&t=40573
But although it is recommended to use a subdomain for images.. it isn't considered a "CDN" since its on the same domain. Due to the way images are auto resized locally, external hosting doesn't really work at this time.
I have all my css and js files in a cdn but its funny because the styles and javascripts load before the images do so it creates some sort of latency.
This free module http://opencart.hostjars.com/opencart-cdn with CloudCache CDN service is the easiest way I've seen to get your site on a CDN.
Documentation: OpenCart User Guide
Mods: Total Import PRO | CSV Import PRO | Ecom Tracking | Any Feed | Autosuggest | OpenCart CDN
Here is a plugin that came out in march. I tried editing the Cloudcache CDN one and its to much of a pane.
http://www.opencart.com/index.php?route ... e=bildukas
http://www.opencart.com/index.php?route ... e=bildukas
Who is online
Users browsing this forum: No registered users and 6 guests