Zikula: A Flexible Open Source Content Management System
home | forum | international support | contact us

Support Forum

Start ::  PostNuke 0.7 Support ::  Tutorials and Solutions ::  Dynamic Image Preloader - Xanthia Plugin

Moderated by: Support Team

Bottom
Dynamic Image Preloader - Xanthia Plugin

  • Link to this postingPosted: 24.01.2005, 01:21
    Profile Homepage
    InvalidResponse
    rank:
    Professional Professional
    registered:
     September 2003
    Status:
    offline
    last visit:
    21.10.07
    Posts:
    2423
    while working with a fairly image intensive theme, i noticed that a few images would lag on load, popping in haphazzardly .. so i started thinking about a preloader, but I didn't want to have to list every stinking image in the image array for every template ("laziness begot innovation" icon_wink ) .. note that this is a hack and may not be suitable for all applications.

    edit: anticracker won't allow the code to be posted.

    read it here

    ..if you've got any improvements..post 'em here icon_smile

    enjoy!
    -IR
    ..now back to work icon_rolleyes

    -----
    http://www.invalidresponse.com
  • Link to this postingPosted: 27.01.2005, 22:47
    Profile Homepage
    InvalidResponse
    rank:
    Professional Professional
    registered:
     September 2003
    Status:
    offline
    last visit:
    21.10.07
    Posts:
    2423
    .sorry.. I just realized when revisiting this thread that the directory wasn't defined and there were a few other fixes since.. i've updated the tutorial..

    since it loops through the images the last image was being defined as "" .. which probably isn't the best way to go about it..but I'm not much of a javascript guy, so whattaiknow.. anyway.. close that loop by adding a 1x1 pixel gif to your document root or define the path of it in the var imagename array() ..

    -----
    http://www.invalidresponse.com
  • Link to this postingPosted: 27.01.2005, 23:29
    Profile Homepage
    Wendell
    rank:
    Professional Professional
    registered:
     February 2004
    Status:
    offline
    last visit:
    14.08.08
    Posts:
    1015
    Nice work! I will be adding this to all my themes. I can see how it will help on the more image-instensive ones. The only change I will make to it is to specify the themes' images directory, where a 1x1 pixel image already resides. Thanks a bundle! icon_smile

    -----
    DWX Logo
  • Link to this postingPosted: 28.01.2005, 22:27
    Profile Homepage
    InvalidResponse
    rank:
    Professional Professional
    registered:
     September 2003
    Status:
    offline
    last visit:
    21.10.07
    Posts:
    2423
    I wasn't even sure it would work.. but it definitely cured my woes icon_smile

    ..as for your suggestion, this particular theme i'm working with uses a background image on all templates, so I did move that image to it's own folder and drew the path to it as the end of the loop.. so it's preloading an image that's actually used instead of the 1x1.

    setting the directory of where the images are preloaded from is cool in concept, but I'm not exactly sure how efficient.. once the "lot" is preloaded, they're already cached by the browser.. so I was thinking about setting a session variable like:

    pnSessionSetVar('preloaded',1);

    then on the next page that's viewed we can check if the variable exists:

    if(pnSessionGetVar('preloaded') == 1){
    return; // already been done
    }

    this would stop the process and prevent preloading what's already been done.. I haven't tried it yet, but I'll let you know when I do icon_smile

    -----
    http://www.invalidresponse.com
  • Link to this postingPosted: 28.01.2005, 22:39
    Profile Homepage
    InvalidResponse
    rank:
    Professional Professional
    registered:
     September 2003
    Status:
    offline
    last visit:
    21.10.07
    Posts:
    2423
    setting the session variable didn't work the way I assumed :?

    -----
    http://www.invalidresponse.com
  • Link to this postingPosted: 04.02.2005, 12:21
    Profile Homepage
    Slugger
    rank:
    Professional Professional
    registered:
     March 2003
    Status:
    offline
    last visit:
    14.08.06
    Posts:
    1185
    Hey IR,

    You know what would be cool? A before and after demo.

    Slugger
  • Link to this postingPosted: 05.02.2005, 03:42
    Profile Homepage
    InvalidResponse
    rank:
    Professional Professional
    registered:
     September 2003
    Status:
    offline
    last visit:
    21.10.07
    Posts:
    2423
    sure would icon_smile ..post back when you've got it all set up icon_lol kidding.

    ..i've got way too much to do, otherwise i'd oblige.

    -----
    http://www.invalidresponse.com
  • Link to this postingPosted: 07.02.2005, 10:01
    Profile Homepage
    Slugger
    rank:
    Professional Professional
    registered:
     March 2003
    Status:
    offline
    last visit:
    14.08.06
    Posts:
    1185
    InvalidResponsesure would icon_smile ..post back when you've got it all set up icon_lol kidding.

    ..i've got way too much to do, otherwise i'd oblige.



    I always thought you had nothing but time! Jeez, I had you pegged wrong! icon_lol

    Slugger
  • Link to this postingPosted: 07.02.2005, 10:38
    Profile Homepage
    InvalidResponse
    rank:
    Professional Professional
    registered:
     September 2003
    Status:
    offline
    last visit:
    21.10.07
    Posts:
    2423
    Slugger
    I always thought you had nothing but time! Jeez, I had you pegged wrong! icon_lol

    I wish I had more.. icon_smile ..damned bills keep coming though. apparently I've buried myself in obligations again.. mostly done with the biggest of the 3, half done with the second and haven't started the third :? ..as long as a couple bucks come my way the 'ol lady doesn't harp as much icon_lol ..i've got an eye on a 17" powerbook, but I just bought a mini so it's kinda on the back burner for a little while.. the laptop would add plenty of extra screen time.. and reduce the harp factor icon_wink

    -----
    http://www.invalidresponse.com
  • Link to this postingPosted: 09.02.2005, 09:11
    Profile Homepage
    Slugger
    rank:
    Professional Professional
    registered:
     March 2003
    Status:
    offline
    last visit:
    14.08.06
    Posts:
    1185
    InvalidResponse
    Slugger
    I always thought you had nothing but time! Jeez, I had you pegged wrong! icon_lol

    I wish I had more.. icon_smile ..damned bills keep coming though. apparently I've buried myself in obligations again.. mostly done with the biggest of the 3, half done with the second and haven't started the third :? ..as long as a couple bucks come my way the 'ol lady doesn't harp as much icon_lol ..i've got an eye on a 17" powerbook, but I just bought a mini so it's kinda on the back burner for a little while.. the laptop would add plenty of extra screen time.. and reduce the harp factor icon_wink


    And I was worried about asking my wife for permission to buy a Shuffle. Man... I do have you pegged wrong! icon_lol

    Slugger
  • Link to this postingPosted: 16.07.2006, 11:41
    Profile
    backharlow
    rank:
    Freshman Freshman
    registered:
     July 2006
    Status:
    offline
    last visit:
    13.01.08
    Posts:
    31
    some of us are yet bachelors and can thus still afford the beefed-up powermac. don't worry, i'll be there soon... icon_cool

Start ::  PostNuke 0.7 Support ::  Tutorials and Solutions ::  Dynamic Image Preloader - Xanthia Plugin

Main Menu

Extensions Database

Documentation

Development

Login





 


 Log in Problems?
 New User? Sign Up!

Donate to Zikula