473,386 Members | 1,785 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Is its possible to preload dynamic images?

I use database to store images. So img-tags are like
<img src="viewer.php?img_id=100">

Can I use javascript/php-combination to preload images of whole site after
first page is loaded? Or does all the images get loaded again automatically
if they have dynamic urls? If so, can that behaviour be changed?
This is the typical jscript i guess:
//-------------------------
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length;
i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
//-------------------------
So then I should write something like this(supposing that I have already
done in php a mysql_query that gets all th necessary images:
<body onload=" MM_preloadImages(<? $str="";
while($row=mysql_fetch_assoc($result)) {$str.=
"\"viewer.php?image_id=".$row['image_id']."\"," } $str =substr($str, 0,
strlen($str)-1); echo $str; ?>);"
Jul 17 '05 #1
3 3118
What about testing is with a huge image?

Just try if dynamic URL's for images are cached on a few systems.

Regards,
Erwin Moller
Jul 17 '05 #2

"Erwin Moller"
<si******************************************@spam yourself.com> kirjoitti
viestissä news:40d94049$0
What about testing is with a huge image?
Just try if dynamic URL's for images are cached on a few systems.


It seems to be that no they aren't. But images are either sent with php's
image_jpg etc or more manually by sending headers first and rawa data then.
Maybe headers are the problem since I use image_jpg and it doesn't give a
chance to manipulate headers. But I dont' have very much experience with
headers. What headers should I send if I send them manually.
Jul 17 '05 #3
"Perttu Pulkkinen" <pe**************@co.jyu.fi> schrieb im Newsbeitrag
news:tg**************@read3.inet.fi...

"Erwin Moller"
<si******************************************@spam yourself.com> kirjoitti
viestissä news:40d94049$0
What about testing is with a huge image?
Just try if dynamic URL's for images are cached on a few systems.
It seems to be that no they aren't. But images are either sent with php's
image_jpg etc or more manually by sending headers first and rawa data

then. Maybe headers are the problem since I use image_jpg and it doesn't give a
chance to manipulate headers. But I dont' have very much experience with
headers. What headers should I send if I send them manually.

I am not sure about that. But what you could do anyway is write the image to
a file and link that file. So the Dreamweaver preload function has a normal
jpg file to preload. Maybe you will need to write a cleanup script to delete
outdated image files from your server later.

HTH
Markus
Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: MALdito | last post by:
hi everybody let me say right from the start .. I´m not a coder ... "just" a designer! that said .. here is my question: I´m using dreamweaver´s built in preloader for a menu. it looks like...
3
by: Bob | last post by:
I usually use some "pre-load" code in my pages to preload graphics that will be swapped. But, I'm thinking that rather than the long, repetitive, once, for each graphic hardcoded stuff like this: ...
2
by: Albert Spencil | last post by:
I have tried several preload scripts found here; plus, some of my own. The only thing that works is the unsophisticated loading of those tiny images. The download consist of 100+ images amounting...
4
by: shapper | last post by:
Hello, I think to preload an image I should us something like: img = new Image(); img.src = 'images/img.jpg'; Could someone tell me how to create a loop which would preload a list of...
4
by: shapper | last post by:
Hello, I am working in Asp.Net 2.0 web sites and I need to preload some images in my master pages and in the pages that use those master pages. Could someone tell me how to do this? Thanks,...
1
by: scripts.contact | last post by:
Is it possible to preload web pages (*without using frame or object*) like you can preload images using Image object ?
9
by: shapper | last post by:
Hello, How can I preload a few images of a page javascript? Should I use CSS to do this? Is it even possible? Thanks, Miguel
2
by: matt9807 | last post by:
The following is a script that I have written that preloads images for an image gallery. The problem is that the images only preload in Safari, other browsers load each image when it is called. Any...
3
by: Revathi Balakrishnan | last post by:
Hi i have the used the below code to switch the button image on mouseover and mouseout. <html:button property="Button" value="Display" styleClass="displaybutton" ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.