473,657 Members | 2,667 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_preloadImage s() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.leng th,a=MM_preload Images.argument s; 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_preloadImage s(<? $str="";
while($row=mysq l_fetch_assoc($ result)) {$str.=
"\"viewer.php?i mage_id=".$row['image_id']."\"," } $str =substr($str, 0,
strlen($str)-1); echo $str; ?>);"
Jul 17 '05 #1
3 3148
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************ *************** *************** @spamyourself.c om> 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.in et.fi...

"Erwin Moller"
<si************ *************** *************** @spamyourself.c om> 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
3648
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 this: 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;
3
1728
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: var bb_off = new Image(); bb_off.src = "images/bb_off.jpg"; ....that I could have an array where I just listed the names of the graphics, a loop, and code in the loop that cycles through each entry in the array to create and pre-load the "on"...
2
3379
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 to 50+mb; and, normally completes in less than 1 minute without preload (using DSL). The preload terminates after 6 or 7 images and seems to time-out in the middle of an image. A reload will download a few more, etc. I have used the <body...
4
1723
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 images? Something like:
4
10357
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, Miguel
1
1514
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
1961
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
1341
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 ideas? imgSeries = new Array(); curImg = ''; function loadkill() { document.getElementById('loadingtxt').style.display = "none"; document.getElementById('imgone').src = imgSeries; document.getElementById('imgtwo').src = imgSeries; }
3
1886
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" onmouseover="this.className='displaybutton displaybuttonover'" onmouseout="this.className= 'displaybutton'"/> CSS definition of displaybutton and displaybuttonover is shown below.
0
8402
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8315
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8829
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8734
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8508
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8608
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5633
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4323
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1962
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.