Jump to content


Photo
- - - - -

Increase Page Load Performance by Use of an Image Subdomain


3 replies to this topic

#1 Ernst Jakob

Ernst Jakob

    Advanced Member

  • Members
  • PipPipPip
  • 34 posts
  • LocationSwitzerland

Posted 13 February 2015 - 12:33 AM

Loading Shop Images from a SubDomain makes a lot of sense, Pagetesters like

"http://tools.pingdom.com" will 'thank you' for this with a much better 'overall perfomance Result.'

 

If you use different 'SITE URL's', but only under the SAME MAIN 'Customer Server DIRECTORY', it makes even more sense to CALL the IMAGE URL from another Site-URL, as shown below. This way, you reduce the LOAD of the Shop Server URL even more, compared with just calling the IMAGES from the same basic URL, by USE of the "http //www .SHOP-Server. ccc/image/" Address.

 

Still, if you have only ONE SITE URL registered within the same (YOURSITE) Server-Directory, DO IT ANYWAY, it will increase Speed in any Case, compared to the DEFAULT OC-Way, i.E.:

 

("home/MyUserName/www/Shop-Server_ccc/shop/image/")

or:

("http //www .SHOP-Server. ccc/image/")

 

'grabbing' it's images from their really OWN 'Place' and trough their OWN 'Lines' and 'Channels', so, not requiring to 'share' the Tasks with the 'Shop' Software itself, building the Page...

 

Many Internal Server Program Files are routed and loaded 'INTERNALLY', just like when you search for an Image on your local harddisk. Some other 'Routines' have to be 'EXECUTED', as deFacto Runtime Program, then, usually, an EXTERNAL HREF Internet based Call may be requested, to make it work. This, in very short, and very lowdown, the difference between HREF Links and INTERNAL Paths...

 

---

 

This is a typical regular Image 'HREF' URL-CALL, by use of this Mod, calling a Site like:

 

http://www.bigmax.ch/shop/

 

Assortment of Files, related:

http://www.ipc.li/os/remoteimages.zip

http://images.openshop.li/shop/image/cache/data/demo/lager-r-228x180.j..

or, if you only have ONE SIte, registered on that specific Server and it's Main Site Directory:

http://images.bigmax.ch/shop/image/cache/data/demo/lager-r-228x180.jp..

as Alternative, next Best to a really 'separate' Way of doing it.  It's better than nothing, because it will DOUBLE the tasks of the Browsers, trying to built the Page out of the Content delievered...

 

Compared with, as it would look like, if used the regular 'www' way:

http://www.bigmax.ch/shop/image/cache/data/demo/lager-r-228x180.jp..

---

 

If I call a related Shop Page like:

http://www.bigmax.ch/shop/index.php?route=product/product&product_id=??

then, this is a REGULAR 'internal Directory-Path' Image-CALL, by use of DEFAULT 'Link-Values':

SERVER_HD_PATH://home/MyUserName/www/bigmax_ch/shop/image/

And this is the 'internal Directory-Path' Image-CALL, by use of MODIFIED 'Values':

SERVER_HD_PATH://home/MyUserName/www/openshop_li/shop/image/

If a Subdomain-Call directs to the same 'Place' as the Shop, the DEFAULT PATH Values will will be used, as mentioned above in the REGULAR Dir-Path Description.

 

...trying to make it a bit more transparent...

 

---

 

Notice:

YOU HAVE TO MAKE SURE, all images related to the Shop will be placed in the REMOTE Image Folders, if you PLACE the Image-URL into an other SITE-URL. Otherways, your image-'Handler' will not display and/or 'handle' all images related.

 

You NEED to operate multiple Servers under the SAME ADMIN accessable Server Path, to make it work under different URL's. THIS, because you need to set PATH's and URL's, and it's not possible for a Server to 'catch' DATA from another Server, on the same Server, but Location and Files placed in an 'outside' Customer Server Path'. I hope, someone understands, what I mean..., and I hope to be 'right' with this as well...

 

This is a typical INTERNAL Server PATH to the MAIN Image SubDir, in contrary to an URL:

'/home/YOURNAME/www/openshop_li/shop/image/');

Every Site, hosted under the 'YOURNAME' Main Directory, would be 'usable' to store and later call your images.

 

In the ZIP File enclosed, you find 3 Images, explaining, where TEXT has to be modified/quoted/deleted (whatever you chose), and added as well. SInce it would be of no use, I have not 'printed' the Config-File Commands anywhere, since they would not match your configuration anyway...

 

Your load time results  will be:

70-85 percent images from http://images... Server

15-30 percent data from http://shop... Server.

 

I bet!

 

Good Luck, I tried to cover it in full...

 

Ernie

ipc.li/shop/

 

---

 

Remarks to the Image Below Subdomains / Aliases:

 

Sometimes, Sub-Domains are named WEBSITE ALIAS as well, just to avoid Confusion.

Your Server Admin Console should usually allow you to to set them up by yourselfs.

 

If setting up an ALIAS, you just DIRECT it's PATH to the Server ROOT, where your OC-Shop Main index+config.php files are located. The 'forwarding' to the Images File Directories works the same as by default, 'starting' the Paths from MAIN FILE ROOT as well.

 

subdomain.jpg

Attached Thumbnails

  • subdomain.jpg

Edited by Ernst Jakob, 04 June 2015 - 07:02 PM.

  • 0

#2 sunsys

sunsys

    Newbie

  • Members
  • Pip
  • 1 posts

Posted 03 May 2015 - 12:31 PM

Ernie, I have tried to follow your instructions ditto and this is what I have done(everything is on the same server),

The demo site is installed in demosite2.in/demo13 where fresh oc1564 is installed.

 

What I have done so far:

1. In the root of my registered domain demosite1, I have created an image sub domain called "imgbox2" (so it looks like http://imgbox2.demosite1.in

2. Then I have modified both configs like:

2a. define('HTTP_IMAGE', 'http://imgbox2.demosite1.in/');      and       define('HTTPS_IMAGE', 'http://imgbox2.demosite1.in/');

2b. define('HTTP_IMAGE', 'http://imgbox2.demosite1.in/');      and       define('HTTPS_IMAGE', 'http://imgbox2.demosite1.in/');

2c. define('DIR_IMAGE', '/home/root/public_html/imgbox2/');

 

and I have done the change as described by you in "remoteimages.zip" by this fix_image_subdomain.xml file which I got from OC forum. 

and so far things are ok and I can see the images of the products on the site but, and always there is a but, that some images are not resolving correctly through the subdomain: imgbox2, like for example the opencart logo is still looking for the image in demosite2.in/demo13/image folder which is obviously not present though the image file manager(resolving correctly to the sub domain-imgbox2) in admin panel allows me to set the opencart logo correctly but is just not showing in the shop header.

 

So what should I do to see that all images everywhere in the shop resolve to the sub domain imgbox2 folder. Please help.

 

Thank You Ernie. 


Edited by sunsys, 03 May 2015 - 01:33 PM.

  • 0

#3 Guest (guest)

Guest (guest)
  • Guests

Posted 07 July 2015 - 07:40 AM

did any figure this out to work correctly on oc 2x?


  • 0

#4 Ernst Jakob

Ernst Jakob

    Advanced Member

  • Members
  • PipPipPip
  • 34 posts
  • LocationSwitzerland

Posted 15 August 2015 - 05:04 PM

> So what should I do to see that all images everywhere in the shop resolve to the sub domain imgbox2 folder. Please help. <

---

Sorry for the long delay, I was not aware of any new postings about this here.

 

Unfortunately, not all images in OC are lined exactly the same way. By examples, in the theme/template/header.tpl,

I have manually replaced the 'internally' linked images the way as shown below, to make 'em HTTP_HREF - adressable,

in addition to avoid them to be CALLED trough a COOKIE-DOMAIN, by JUST removing the http;//WWW/ Characters, since

my Shop is configured to be addressed 'http://www.myshop.com'

 

Sample Lines Header.tpl:

<div id="logo"><a href="<?php echo $home; ?>"><img src="http://hitline.info/.../logo.png......
<div class="warning"><?php echo $error ?><img src="http://hitline.info/...close.png......
<a href="<?php echo $shopping_cart; ?>"><?php echo $text_shopping_cart; ?> &nbsp; <img src="http://hitline.info/.....
<a href="<?php echo $checkout; ?>"><?php echo $text_checkout; ?> &nbsp; <img src="http://hitline.info/shop/catalog/....

 

In addition, many MOD's/Extensions contain IMAGE PATHS, and/or IMAGE LINKS, using the DEFAULT DIR_IMAGE Path to address Images, but by use of an Image SUbdomain, one needs to change such Link/PATH's to HTTP_IMAGE as well, to make those Mod's work.

 

In other Mod's, I had to insert the full Image Site url:

      <?php if ($product['image']) {
          $img_file = "http://images.openshop.li/shop/image/" . $product['image'];

instead of (weary!) stuff like this:

      <?php if ($product['image']) {
          if (class_exists('MijoShopOpencart')) {$mijoshop = '../components/com_mijoshop/opencart/admin/';} else {$mijoshop = '';}
          $img_file = $mijoshop . "../image/" . $product['image'];

as, by example, in the nice:

Admin - Sale Order 2.9 - CZ faktura - OC 1.56x (dodlist-faktura-DPH) (admin-vqmod)

 

just to give you an impression, on how it can be done, if you really want to make it 'complete', troughout your Shop, and including
all the Mod's, you probably have installed.

---

I have updated the content of the File a little:

http://www.ipc.li/os/remoteimages.zip

---

Good Luck

Ernie


  • 0



Reply to this topic



  



 

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Community Skin by Fredson Nunes Junior