473,732 Members | 2,196 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need help with image loading

I have never written a line of script in my life but I need some help with
it now.

I have this auto generated code which I want to modify if possible

The script generates a strip of thumbnails, and works quite well execpt that
on dial up it is unbearably slow. The Thumbnails themselves are only 10kb
but the total of them is a lot larger. and it appears to need to load them
all before it will display any.
In HTML if the size of the pic is defined the page loads quicker so I was
thinking that I could do the same in this script.

If it is possible, where would I place these dimensions in the script below?

Mekon

<html>
<head>
<title>The Importance of Being Musically Earnest</title>
<meta name="Generator " Content="PhotoC leaner">
</head>

<body bgcolor=white background=film .gif><font color=gray
face="Verdana,A rial,Helvetica" >

<script>

var im = new Array(1023);

var SelectedImage = 0;

im[0] = new Image();
im[0].src = 'PC-Earnest02.jpg';
im[0].exif = '';
im[0].thumb = 'Thumbs/PC-Earnest02.jpg';
im[1] = new Image();
im[1].src = 'PC-Earnest03.jpg';
im[1].exif = '';
im[1].thumb = 'Thumbs/PC-Earnest03.jpg';
im[2] = new Image();
im[2].src = 'PC-Earnest04.jpg';
im[2].exif = '';
im[2].thumb = 'Thumbs/PC-Earnest04.jpg';
im[3] = new Image();
im[3].src = 'PC-Earnest05.jpg';
im[3].exif = '';
im[3].thumb = 'Thumbs/PC-Earnest05.jpg';
im[4] = new Image();
im[4].src = 'PC-Earnest09.jpg';
im[4].exif = '';
im[4].thumb = 'Thumbs/PC-Earnest09.jpg';
im[5] = new Image();
im[5].src = 'PC-Earnest10.jpg';
im[5].exif = '';
im[5].thumb = 'Thumbs/PC-Earnest10.jpg';
im[6] = new Image();
im[6].src = 'PC-Earnest16.jpg';
im[6].exif = '';
im[6].thumb = 'Thumbs/PC-Earnest16.jpg';
im[7] = new Image();
im[7].src = 'PC-Earnest17.jpg';
im[7].exif = '';
im[7].thumb = 'Thumbs/PC-Earnest17.jpg';
im[8] = new Image();
im[8].src = 'PC-Earnest18.jpg';
im[8].exif = '';
im[8].thumb = 'Thumbs/PC-Earnest18.jpg';
im[9] = new Image();
im[9].src = 'PC-Earnest19.jpg';
im[9].exif = '';
im[9].thumb = 'Thumbs/PC-Earnest19.jpg';
im[10] = new Image();
im[10].src = 'PC-Earnest20.jpg';
im[10].exif = '';
im[10].thumb = 'Thumbs/PC-Earnest20.jpg';
im[11] = new Image();
im[11].src = 'PC-Earnest21.jpg';
im[11].exif = '';
im[11].thumb = 'Thumbs/PC-Earnest21.jpg';
im[12] = new Image();
im[12].src = 'PC-Earnest22.jpg';
im[12].exif = '';
im[12].thumb = 'Thumbs/PC-Earnest22.jpg';
im[13] = new Image();
im[13].src = 'PC-Earnest25.jpg';
im[13].exif = '';
im[13].thumb = 'Thumbs/PC-Earnest25.jpg';
im[14] = new Image();
im[14].src = 'PC-Earnest26.jpg';
im[14].exif = '';
im[14].thumb = 'Thumbs/PC-Earnest26.jpg';
im[15] = new Image();
im[15].src = 'PC-Earnest27.jpg';
im[15].exif = '';
im[15].thumb = 'Thumbs/PC-Earnest27.jpg';
im[16] = new Image();
im[16].src = 'PC-Earnest29.jpg';
im[16].exif = '';
im[16].thumb = 'Thumbs/PC-Earnest29.jpg';
im[17] = new Image();
im[17].src = 'PC-Earnest30.jpg';
im[17].exif = '';
im[17].thumb = 'Thumbs/PC-Earnest30.jpg';
im[18] = new Image();
im[18].src = 'PC-Earnest31.jpg';
im[18].exif = '';
im[18].thumb = 'Thumbs/PC-Earnest31.jpg';
im[19] = new Image();
im[19].src = 'PC-Earnest35.jpg';
im[19].exif = '';
im[19].thumb = 'Thumbs/PC-Earnest35.jpg';

i = 0;

document.write( '<center>');

while (im[i]) {
document.write( '<a href="" onclick="return ShowDetails(' + i + ');"><img
align=center hspace=10 name="_' + im[i].name + '" border=0 src="' +
im[i].thumb + '"></a><br><br>');
i++;
}
var inter = window.setInter val("ShowDetail s(0)", 200);

slide=0;

function isIE() {
return navigator.appNa me == 'Microsoft Internet Explorer';
}

function ShowDetails(i) {
parent.frames["main"].document.image s[0].src = im[i].src;
document.images[SelectedImage].border = 0;
parent.document .title = document.title;
if (isIE()) {
parent.main.Des cr.innerHTML = im[i].exif;
} else {
parent.frames["main"].document.forms[0]["Descr"].value =
im[i].exif.replace(/<br>/g,"\n");
if (im[i].exif == "") {

parent.frames["main"].document.forms[0]["Descr"].style.display= 'none';
} else {

parent.frames["main"].document.forms[0]["Descr"].style.display= 'block';
}
}
SelectedImage = i;
document.images[SelectedImage].style.borderSt yle = "dotted";
document.images[SelectedImage].style.borderCo lor = "gray";
document.images[SelectedImage].border = 3;
if (document.image s[SelectedImage].offsetTop < document.body.s crollTop) {
document.body.s crollTop = document.images[SelectedImage].offsetTop-10;
}
if
(document.image s[SelectedImage].offsetTop+docu ment.images[SelectedImage].hei
ght > document.body.s crollTop+docume nt.body.clientH eight) {
document.body.s crollTop =
(document.image s[SelectedImage].offsetTop+docu ment.images[SelectedImage].hei
ght)-document.body.c lientHeight+10;
}
slide = SelectedImage;
window.clearInt erval(inter);
return false;
}
var slideshowinterv al = 0;

function ShowStart(){
slideshowinterv al = window.setInter val("SlideShow( )", 5000);
}

function ShowStop(){
window.clearInt erval(slideshow interval);
}
function SlideShow() {
slide++;
if (!im[slide]) {
slide=0;
}
ShowDetails(sli de);
}

</script>

</body>
</html>



--
http://www.camelraces.com/
Jul 20 '05 #1
2 2387
new Image([width,] [height])

so
im[0] = new Image();
im[0].src = 'PC-Earnest02.jpg';
im[0].exif = '';
im[0].thumb = 'Thumbs/PC-Earnest02.jpg';
would look like
im[0] = new Image(20, 20);
im[0].src = 'PC-Earnest02.jpg';
im[0].exif = '';
im[0].thumb = 'Thumbs/PC-Earnest02.jpg';

But this line of code scares me

var im = new Array(1023);

That indicates that you are going to have an image array with 1023
thumbnails. Aint no way you're going to get any performance boost that makes
loading 1023 images over dial up "speedy".

Good luck

"Mekon" <bl*********@ho tmail.com> wrote in message
news:CM******** ********@news-server.bigpond. net.au... I have never written a line of script in my life but I need some help with
it now.

I have this auto generated code which I want to modify if possible

The script generates a strip of thumbnails, and works quite well execpt that on dial up it is unbearably slow. The Thumbnails themselves are only 10kb
but the total of them is a lot larger. and it appears to need to load them
all before it will display any.
In HTML if the size of the pic is defined the page loads quicker so I was
thinking that I could do the same in this script.

If it is possible, where would I place these dimensions in the script below?
Mekon

<html>
<head>
<title>The Importance of Being Musically Earnest</title>
<meta name="Generator " Content="PhotoC leaner">
</head>

<body bgcolor=white background=film .gif><font color=gray
face="Verdana,A rial,Helvetica" >

<script>

var im = new Array(1023);

var SelectedImage = 0;

im[0] = new Image();
im[0].src = 'PC-Earnest02.jpg';
im[0].exif = '';
im[0].thumb = 'Thumbs/PC-Earnest02.jpg';
im[1] = new Image();
im[1].src = 'PC-Earnest03.jpg';
im[1].exif = '';
im[1].thumb = 'Thumbs/PC-Earnest03.jpg';
im[2] = new Image();
im[2].src = 'PC-Earnest04.jpg';
im[2].exif = '';
im[2].thumb = 'Thumbs/PC-Earnest04.jpg';
im[3] = new Image();
im[3].src = 'PC-Earnest05.jpg';
im[3].exif = '';
im[3].thumb = 'Thumbs/PC-Earnest05.jpg';
im[4] = new Image();
im[4].src = 'PC-Earnest09.jpg';
im[4].exif = '';
im[4].thumb = 'Thumbs/PC-Earnest09.jpg';
im[5] = new Image();
im[5].src = 'PC-Earnest10.jpg';
im[5].exif = '';
im[5].thumb = 'Thumbs/PC-Earnest10.jpg';
im[6] = new Image();
im[6].src = 'PC-Earnest16.jpg';
im[6].exif = '';
im[6].thumb = 'Thumbs/PC-Earnest16.jpg';
im[7] = new Image();
im[7].src = 'PC-Earnest17.jpg';
im[7].exif = '';
im[7].thumb = 'Thumbs/PC-Earnest17.jpg';
im[8] = new Image();
im[8].src = 'PC-Earnest18.jpg';
im[8].exif = '';
im[8].thumb = 'Thumbs/PC-Earnest18.jpg';
im[9] = new Image();
im[9].src = 'PC-Earnest19.jpg';
im[9].exif = '';
im[9].thumb = 'Thumbs/PC-Earnest19.jpg';
im[10] = new Image();
im[10].src = 'PC-Earnest20.jpg';
im[10].exif = '';
im[10].thumb = 'Thumbs/PC-Earnest20.jpg';
im[11] = new Image();
im[11].src = 'PC-Earnest21.jpg';
im[11].exif = '';
im[11].thumb = 'Thumbs/PC-Earnest21.jpg';
im[12] = new Image();
im[12].src = 'PC-Earnest22.jpg';
im[12].exif = '';
im[12].thumb = 'Thumbs/PC-Earnest22.jpg';
im[13] = new Image();
im[13].src = 'PC-Earnest25.jpg';
im[13].exif = '';
im[13].thumb = 'Thumbs/PC-Earnest25.jpg';
im[14] = new Image();
im[14].src = 'PC-Earnest26.jpg';
im[14].exif = '';
im[14].thumb = 'Thumbs/PC-Earnest26.jpg';
im[15] = new Image();
im[15].src = 'PC-Earnest27.jpg';
im[15].exif = '';
im[15].thumb = 'Thumbs/PC-Earnest27.jpg';
im[16] = new Image();
im[16].src = 'PC-Earnest29.jpg';
im[16].exif = '';
im[16].thumb = 'Thumbs/PC-Earnest29.jpg';
im[17] = new Image();
im[17].src = 'PC-Earnest30.jpg';
im[17].exif = '';
im[17].thumb = 'Thumbs/PC-Earnest30.jpg';
im[18] = new Image();
im[18].src = 'PC-Earnest31.jpg';
im[18].exif = '';
im[18].thumb = 'Thumbs/PC-Earnest31.jpg';
im[19] = new Image();
im[19].src = 'PC-Earnest35.jpg';
im[19].exif = '';
im[19].thumb = 'Thumbs/PC-Earnest35.jpg';

i = 0;

document.write( '<center>');

while (im[i]) {
document.write( '<a href="" onclick="return ShowDetails(' + i + ');"><img align=center hspace=10 name="_' + im[i].name + '" border=0 src="' +
im[i].thumb + '"></a><br><br>');
i++;
}
var inter = window.setInter val("ShowDetail s(0)", 200);

slide=0;

function isIE() {
return navigator.appNa me == 'Microsoft Internet Explorer';
}

function ShowDetails(i) {
parent.frames["main"].document.image s[0].src = im[i].src;
document.images[SelectedImage].border = 0;
parent.document .title = document.title;
if (isIE()) {
parent.main.Des cr.innerHTML = im[i].exif;
} else {
parent.frames["main"].document.forms[0]["Descr"].value =
im[i].exif.replace(/<br>/g,"\n");
if (im[i].exif == "") {

parent.frames["main"].document.forms[0]["Descr"].style.display= 'none';
} else {

parent.frames["main"].document.forms[0]["Descr"].style.display= 'block';
}
}
SelectedImage = i;
document.images[SelectedImage].style.borderSt yle = "dotted";
document.images[SelectedImage].style.borderCo lor = "gray";
document.images[SelectedImage].border = 3;
if (document.image s[SelectedImage].offsetTop < document.body.s crollTop) { document.body.s crollTop = document.images[SelectedImage].offsetTop-10; }
if
(document.image s[SelectedImage].offsetTop+docu ment.images[SelectedImage].hei ght > document.body.s crollTop+docume nt.body.clientH eight) {
document.body.s crollTop =
(document.image s[SelectedImage].offsetTop+docu ment.images[SelectedImage].hei ght)-document.body.c lientHeight+10;
}
slide = SelectedImage;
window.clearInt erval(inter);
return false;
}
var slideshowinterv al = 0;

function ShowStart(){
slideshowinterv al = window.setInter val("SlideShow( )", 5000);
}

function ShowStop(){
window.clearInt erval(slideshow interval);
}
function SlideShow() {
slide++;
if (!im[slide]) {
slide=0;
}
ShowDetails(sli de);
}

</script>

</body>
</html>



--
http://www.camelraces.com/

Jul 20 '05 #2

"Mike" <mi************ *****@synovic.c om> wrote in message
news:Sq******** ************@co mcast.com...
new Image([width,] [height])

so
im[0] = new Image();
im[0].src = 'PC-Earnest02.jpg';
im[0].exif = '';
im[0].thumb = 'Thumbs/PC-Earnest02.jpg';
would look like
im[0] = new Image(20, 20);
im[0].src = 'PC-Earnest02.jpg';
im[0].exif = '';
im[0].thumb = 'Thumbs/PC-Earnest02.jpg';

But this line of code scares me

var im = new Array(1023);

That indicates that you are going to have an image array with 1023
thumbnails. Aint no way you're going to get any performance boost that

makes loading 1023 images over dial up "speedy".

Good luck

There isn't that many images.... *that* might be part of the problem.

Thanks

Mekon
Jul 20 '05 #3

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

Similar topics

2
4444
by: Rob Manger | last post by:
Hi All, I am hoping someone can help me. I am trying to setup my main page so that when the user moves the mouse over an image, it changes the source (got this working). When the user CLICKS on the image (it is a link to the content page) it changes to a third image AND STAYS THERE. ie: so the iamge won't change back to the omouseoff image. Does this make sense? Also, how do I "preload" the images before they are even needed? eg:...
1
10208
by: Adam Ratcliffe | last post by:
I'm trying to come up with a solution for detecting when an image, loaded by a script, has completely loaded. The Image.onload event is fired after the image has loaded in Firefox but before loading has completed in Internet Explorer. The function where I assign the onload event handler looks like this: var newImage = new Image(); function getImage(url) { var image = document.getElementById("theImg");
3
2347
by: B Maxey | last post by:
I am storing images in a database and need a way to browse those files. I can load the files into an image list or whatever the control needs, but I need a control. It doesn't seem that any of the standard window controls would work, but I am thinking I can just draw all the images on an panel (or a browser form for that matter). Does anyone have any advice?
4
5177
by: Sharon | last post by:
Hi Everyone, I have a TIF file 62992 x 113386 Pixels, Huffman RLE compression, 3200 x 3200 DPI resolution, binary colored (1 Bit Per Pixel), file on disk size 43.08 MB (45,169,042 Bytes). This kind of image should consume 851.66 MB (893,028,184 Bytes) of memory when loaded, and this is exactly what I want it to consume. Otherwise; the representation per pixel will be 1 byte (8 Bits), which means that this kind of image require 6.652 GB...
2
1656
by: Irfan Akram | last post by:
Hi Guys, I asked this question yesterday, but have not yet received a suitable answer. I hope you guys can help me out. I want to load an image on to a web-page. The image is alreday stored in my database. Currently when I load the image on to the page it loads on to the full page using the following code: - Response.ContentType = dr.ToString();
10
4193
by: abcd | last post by:
I have PIL 1.1.5 on python 2.4.1 and I am attempting to get a smaller (file size) of an image. for example: im = ImageGrab.grab() im.save("tmp.gif") ---- about 1.7mb im.save("tmp.jpeg") ---- about 290kb anyways I want to save the image as a GIF, but not have it be so
4
1383
by: Tim Streater | last post by:
I have a small image on my web page that, when clicked, does some javascript stuff which changes the page. To highlight that this has happened, I want to replace the image with another. Each is a 16x16 pixel image. The images are pre-loaded: var image_g = new Image (16, 16); var image_r = new Image (16, 16); image_g.src = 'pics/arrow-g.jpg';
6
7859
by: Cruithne3753 | last post by:
I'm trying to create a Windows app with a clickable index of images within a local folder. Within a loop I've got:- PictureBox pb = new PictureBox(); pb.Image = Image.FromFile(file); .... pnlImageIndex.Controls.Add(pb);
1
1802
by: ttamilvanan81 | last post by:
Hai everyone, I am working with a Image/Video Application. I need to display and play any video file in browser. Now i am using the following Embed Tag. <OBJECT ID="mediaPlayer" CLASSID= "clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" CODEBASE= "http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" TYPE="application/x-oleobject"
0
8946
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
8774
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
9447
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...
1
9235
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
9181
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
4809
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3261
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2180
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.