RevIgniter - Loading Images

Web Admin Himalayan Academy katir at hindu.org
Fri Mar 25 00:12:11 EDT 2011


  On 3/24/11 4:51 PM, Robert Mann wrote:
> "Robert, here is my simple function to drive a random selection from a
> folder of images, the image is loaded once on page load and does not
> change until next page load. this may not be what you want... "
>
> Many thanks its exactly what I was going to program : a random selection of
> an image for each page call! I did not grasp the way it you did that in 5
> seconds but will dig it next week, and let know and share handlers to do
> that!
[warning, if you are not familiar with apache future expires header
and caching performance issues, the following may be all ZULU to you.]

Just remember once you finish the testing to set the cache busting to 
false in my code I should have made that clear.

(I assume you have far future expires headers set on your server, you 
can do this with .htaccess of your site if you don't have access to the 
core httpd.conf...just put  this in your .htaccess file:

ExpiresActive On
ExpiresDefault "access plus 10 years"


see http://developer.yahoo.com/blogs/ydn/posts/2007/05/high_performanc_2/

for details

e.g. when developing do this:

put rigCssAsset("ha-new.css",,,TRUE) into gData["haNewCSS"] # Load Base 
Styles

when you stop changing your css and you know you are not going to change 
anything for a while then

put rigCssAsset("ha-new.css",,,FALSE) into gData["haNewCSS"] # Load Base 
Styles

and change:

    put (rigImageAsset(tBackGroundPath,,,TRUE))  into pTaggedImage

to

    put (rigImageAsset(tBackGroundPath,,,FALSE))  into pTaggedImage

Later if you start developing again and you find things are not updating 
as you work, instead of having to go empty the cache all the time, just 
set these back to "TRUE"   actually for certain sets of images there's 
hardly any reason use TRUE because the likelihood that i would put up a 
different version of "waialeale-sunset-dcsn6463.jpg" with the same name 
if very unlikely...

But if your content designers start throwing different versions of 
"masthead.jpg" onto the server every day, they you definitely will want 
to set it to TRUE  so that they will see their new image come up as they 
test...otherwise they will come crying to you that they never see their 
new baby on the screen and it keeps showing yesterdays' version of 
"masthead.jpg"

> It would be nice to have a respository of revIgniter compatible handlers
> somewhere. Maybe the best place is on rev lessons!? Because it needs a
> little explanation also!

Agreed! Not sure what is best.  Happy to contribute moving forward... I 
think best would be a blog on Ralf site to guard against fragmentation.








More information about the use-livecode mailing list