Announcement

Collapse
No announcement yet.

using subdomains to serve images

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    using subdomains to serve images

    in order to speed up web page loading times, manage resources etc, I want to server some of my resources from subdomains so and want to understand how actinic treats the use of images contaning the http:// tags
    I also recognise that I start stepping out of the "actinic safety net", and I become 100% responsible for moving/maintaining/deleting images from my sub domains, the trade off being a much faster verification/checking/upload process when refreshing the site - again, outside the "actinic safety net" - its a trade off I am prepared to accept

    let me explain.

    within the actual main page layout, its easy to have code such as <img src='myimage.jpg'>, taking that a stage further, I can use <img src='http://images/mydomain.com/myimage.jpg'> and serve all those images from the subdomain.
    taking it to the third level, I can then introduce an actinic variable to the tag and generate code like <img src='<actinic:variable name="CompanyDomainImages" />/myimage.jpg'> allowing me to copy the entire site to another place, change the odd actinic variable and then have everything pointing to images on images.anotherdomain.com - this for multi user sites, may be quite an advantage.

    this "works" fine but I now need to understand how the "internal upload to the web" process works. - using the following programming choices
    1. <img src='myimage.jpg'>
    2. <img src='http://images/mydomain.com/myimage.jpg'>
    3. <img src='<actinic:variable name="CompanyDomainForImages" />/myimage.jpg'>


    how does the internal upload process work ??-
    1. tries to find myimage.jpg on the local server and uploads it as part of the refresh process
    2. assumes you've put the right url in, and generates code accordingly but DOES NOT try to upload anything from the local server as part of the refresh process
    3. what happens here, I know it generates the correct url code for me, but does it still try to look for the image on the local server like option 1, ignore the image like 2, or just gets its knickers in a twist??


    I then want to take this a stage further and move some of my main product images to a subdomain.
    so within the layouts, you see <img src="<actinic:variable name="ProductImageFileName" />"
    I want to change that to <img src="<actinic:variable name="CompanyDomainForImages" />/<actinic:variable name="ProductImageFileName" />" . . .


    if I adopt a similar approach as show above, how does the internal parser/upload process handle those.

    can anyone help please
    kev

    #2
    Anything other than (1) and Actinic does nothing with your code. Actinic assumes it's your business and simply passes through the HTML unaltered.

    With some PHP in your image layouts, you could probably extract the basename of the image filename, prepend your external href, and write a list of all files so processed. You could then pass this list to an FTP program that uploads them independently of Actinic. Or perhaps upload while processing via the internal PHP but I wouldn't be at all surprised if this didn't crash Actinic.

    Even if you manage this, I doubt that you will achieve your initial idea - "in order to speed up web page loading times". Probably most servers can output text and images as fast as the wire allows. Perhaps you intend to use separate servers with separate connections to the outside world; one for HTML and the other for images. Even doing that you will still be limited by the wire speed of the clients PC.

    This seems a bit like the quasi-religous requirements we occasionally see here. You know, like those who insist on all their pages being 100% table free, require the 100% validation, do without <actinic ... > tags, etc.
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


      #3
      thanks for the heads-up on the processing, appreciated.

      This seems a bit like the quasi-religous requirements we occasional see here. You know, like those who insist on all their pages being 100% table free, require the 100% validation, do without <actinic ... > tags, etc.
      don't get me wrong, I'm not one of the quasi-religous zealots. I am in charge of a team writing 24/7 database/json/html applications all day long for a freight company. Its always been up to me to handle the images and other resources, and we don't get the luxury of actinic uploading/checking all those other resources.
      I regularly run yslow, google page speed or others (depending on whether its ajax type applications or just quick serving of tabular data) to see where the potential bottle necks are, I use jslint to make sure the javsscript is ok, optimise graphics where poss, all those things that the webmaster ought to do to try to dish out a responsive interaction with the user but I don't spend hours trying to save 5ms, the ability to maintain the applications and spot where a problem is can frequently override the 20ms savings offered by a re-write

      I dont believe in 100% validation, 100% standards at all costs but I do write cross browser html where ever poss - if tables work easier, I'll happily use them, it its css, then thats fine. but don't get me started with inline styles when css will achieve better results

      The question came about because of speed increases I've seen in my internal html applications when I started serving some of my resources from other subdomains.

      This is one place I am NOT lecturing norman, he's a fantastic prescence on the forum, but if we don't ask questions, how do you learn?

      All browsers queue thier requests for the resource fetches, whether thats html, css, js, imgs, etc etc and most can only fetch up to 6 asynchronously. The moment you get more than 6 being queued, you get lags waiting for the first ones to be served, why not take advantage of a second domain (your images, your javascript) giving you another 6 asynchronous requests all going on at the same time as the first set.
      Once a DNS lookup has been carried out on the local PC, then thats cached, so we can ignore the DNS lookup issue.

      Personally, I will probably be prefixing the images with certain letters, then detecting the prefix with php, and automatically generating the correct subdomain, why not serve thumbnails from the "thumbnail subdomain" when a simple bit of php could do it for you by detecting on "th_myimage.jpg"

      If I start getting uploading issues with the generated php, then I will go back to the actinic variable methods but either way, why not try, look where we would be if Gabe didn't try some "crazy ideas"

      thanks for the reply Norman

      kev

      Comment


        #4
        Have you tried compressing your images another 5% and see how that compares with the gains of off domain image hosting?


        Bikster
        SellerDeck Designs and Responsive Themes

        Comment


          #5
          prepared to try lots of different things, anyone got any other ideas for "performance gains" ?

          Comment


            #6
            Kevin,

            Wasn't getting at you by any means. You've obviously got the skill and expect enough gains to make this worth trying out.

            One minor consideration is that I think that Actinic will automatically upload images into the acatalog folder if they're defined in the Product Details / Product Image entry. A minor problem in that it will do this once (as it keeps an internal list of what's uploaded and only re-uploads them if they change). So you'll probably have an initial double-upload to consider - once to acatalog for the originals and the other for your renamed images to your chosen separate directory.

            The built-in PHP has got FTP enabled. Just put !!<<actinic:block php="true">phpinfo();</actinic:block>>!! temporarily into a product or fragment descriptoin and you'll get the entire list of capabilities.
            Norman - www.drillpine.biz
            Edinburgh, U K / Bitez, Turkey

            Comment


              #7
              Thanks again Norm,

              Actinic will automatically upload images into the acatalog folder if they're defined in the Product Details / Product Image entry
              no way around that one I assume :-(

              can't make up my mind now I know that one, I suppose I could just create a filename based variable, tie it to the product, and then generate the code from the var, but then knowing my luck, the image field probably affects other things that I'm not aware of.

              thinking off the top of the head, I could of course put "dummy.jpg" into the image field - then if the field contains "dummy.jpg" , repoint to use the new variable in its place, otherwise use the actual image being quoted (best of both worlds)
              and then that way, it would only ever try uploading a single identical image (very small, very fast) once plus all the other real images.
              would of course need to autodetect the width/height attributes and generate those, but could still re-use the alt-variable. No doubt there's other bits, but nothing that couldn't be gleaned fromt he standard image layout.

              and like you say, phpinfo() does already get used, finding out the capabilities opens up another world of options

              kev

              Comment


                #8
                just a thought,
                if I create a filename based custom variable and then use it within the layouts, I don't suppose actinic then collects those filenames together and starts to upload those as well (bit like actinic being too clever for its own good and circumventing all my work)

                Don't suppose you know the answer to that one Norman ?

                Comment


                  #9
                  if I create a filename based custom variable...
                  I did a quick test (why didn't you?). Created a product level filename variable which isn't used in any layouts. Set it on a single product to a file that was never used anywhere else on the site. File was uploaded. And not deleted from the server after I cleared the variable.
                  Norman - www.drillpine.biz
                  Edinburgh, U K / Bitez, Turkey

                  Comment


                    #10
                    Originally posted by completerookie View Post
                    in order to speed up web page loading times
                    Are you doing this for SEO purposes?
                    "If my answers frighten you then you should cease asking scary questions"

                    Comment


                      #11
                      I did a quick test (why didn't you?).
                      I'm actually on hols , with access to a certain amount of my PC, but not everything, otherwise would have done so

                      having said that, because actinic uploaded, it seems it has already circumvented my plan ( curses )

                      Comment


                        #12
                        Are you doing this for SEO purposes?
                        I had read about google doing this, but I think I also read somewhere that it only applies to those going through google.com (at the moment) - the main reason is one of the "perceived" speed of the internal sites I maintain (being asked "its faster today, have you done anything?") and as you can imagine, the word percieved is very subjective.

                        I realise there''s quite a few other SEO techniques that could be implement with less effort if it was just SEO

                        If, and its a big if, the idea doesn't take too much to implement, then I thought I would try it on a new site, I'm not planning to re-code existing sites, seems like far too much work.

                        Comment

                        Working...
                        X