subdomain hookup!

Rebuilding the code

Fixing Nextgen gallery to play nice!

Yeah I’m a dork. I’ve been geeking out on ways to make the site faster, and today I managed to move all of my images over to their own subdomain.

What this means is that all of the images can now be loaded in parallel with all of the other files that you are opening. Before it would take a little while for all of the images to load on the site. Thats because all of the files were being loaded thru a single source. Now that I have subdomains set up for all of the images, html, cssimages, and javascript files which make up this site. They all now come from different locations. Instead on one funnel there are four and so everything moves faster. yeah!

The hardest part of all this was trying to redirect all of the images from the Nextgen Gallery plugin that I use. Today I was digging through the php files and I found the little snippet of code for the base url. I changed it and TA DA! like magic suddenly everything worked! Problem solved.

Go go gadget geek powers!

3 Comments

Dude,
why don’t you let us know which files you changed,
and how you managed to do all that ……

you wiz

regards

JOe

Nice tweet :

I am floating in a dream of happy memories long gone by. Please don’t wake me from this bliss.

If you do wake up, pls check your comments bro :-)

best regards

Joe

Sorry Joe. I was on a road trip this last week and couldn’t look up the files you were asking about until now.

the file in question is: /plugins /nextgen-gallery/lib/image.php
lines:66-73 (here they are unedited)

// set urls and paths
$this->imageURL = site_url() . '/' . $this->path . '/' . $this->filename;
$this->thumbURL = site_url() . '/' . $this->path . '/thumbs/thumbs_' . $this->filename;
$this->imagePath = WINABSPATH.$this->path . '/' . $this->filename;
$this->thumbPath = WINABSPATH.$this->path . '/thumbs/thumbs_' . $this->filename;
$this->meta_data = unserialize($this->meta_data);
$this->imageHTML = $this->get_href_link();
$this->thumbHTML = $this->get_href_thumb_link();

I believe you simply change “site_url()” to whatever your desired sub-domain is and adjust the rest of the path accordingly. i’m not 100% on this anymore as I have changed changed my files back and Next gen has had a few updates since.

This had worked fine but I was getting annoyed. Any time I updated Next-gen i’d have to manually do all of the changes again. It was getting to be a real pain.

I don’t know if this is important to you but I also found that since all of the files are coming from a sub domain that my analytics for those images were not being tracked. At the time I think I had searched the next gen forums and found that is a problem which is hard to remedy. I also found that although I had speed gains that I could make better time by simply leaving nextgen and alone optimizing other parts of my code. For instance its a bit bit more practical to just use a lazy loading plugin, the images still load slow but the preseived speed is a lot faster and usually thats all that really matters.

Sorry about the delay and the pourly documented original post. I hope this new info helps point you in the right direction.

Comments are closed.