Author Topic: Loader before every file  (Read 18382 times)

0 Members and 1 Guest are viewing this topic.

Offline zaisk

  • Jr. Member
  • **
  • Posts: 93
    • View Profile
Loader before every file
« on: November 18, 2005, 08:16:36 PM »
Hi,

Please help me. I need loader, which will appear before every file on my gallery (before gif,jpg,swf,mpeg else...) For exmaple when people press on thumbnaile, before opening the file the script shows 5seconds the loader where could be advertise or else.

If is it possible that the loader could be html file, that would be the greatest thing.

Could anyone help me.

I have seen the loader on this forum, but just for jpg files. Could the same loader be corrected for my interests.?

Deep Thanks From Me,
Regards,
ZAisk

Offline Acidgod

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 2.421
  • It's me?
    • View Profile
    • Flash-Webdesign
Re: Loader before every file
« Reply #1 on: November 19, 2005, 09:39:33 AM »
Mod 2: A Loading info when a image is loading
Simply HTML trick:
Create a table around your image (jpg.html media template) with "loading" image on backgroud. When the image fully loaded it will "cover" the "loading" image.

You meen this?
Also you can use a Javascript Preloader... Search google there are a many JS for this...

Offline zaisk

  • Jr. Member
  • **
  • Posts: 93
    • View Profile
Re: Loader before every file
« Reply #2 on: November 19, 2005, 10:55:04 AM »
I searceh the google, but ... :) I am new in php and java, Maybe Someone could help doing all that. ??? Maybe someone could tell me waht code and where to change, Please...

Thank you,
Regards

Offline Acidgod

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 2.421
  • It's me?
    • View Profile
    • Flash-Webdesign
Re: Loader before every file
« Reply #3 on: November 19, 2005, 11:02:27 AM »
when you need help by a Java Script (IS NOT JAVA!) try:
http://www.javascript.com/ for example...

When you find a Java Script there then come back an we will try to put in the 4images Code...

Offline zaisk

  • Jr. Member
  • **
  • Posts: 93
    • View Profile
Re: Loader before every file
« Reply #4 on: November 19, 2005, 11:55:31 AM »
Ok, I will try to find, but I not really know for what I am searching...:)
Did you noticed that I need that preloader for the flash (swf) files?
Wat the name of the JavaScript should be (for searching) ? Preloader, loader? Or else...?

Offline zaisk

  • Jr. Member
  • **
  • Posts: 93
    • View Profile
Re: Loader before every file
« Reply #5 on: November 19, 2005, 12:06:10 PM »
I found something here:

 http://www.webclass.ru/tut.php?tut=194

Is is that, what I am looking for ? :)

Could I with this script make that before opening the swf file about 5-7 seconds people will be able to see advertisement?

Offline zaisk

  • Jr. Member
  • **
  • Posts: 93
    • View Profile
Re: Loader before every file
« Reply #6 on: November 19, 2005, 12:38:15 PM »
I found the best script (In my opinion), I wonder to finde the script wich will be showing while loading not gif, but html page. Maybe I found something. The script is 3 files:

1) Index.html
Code: [Select]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" src="preloader.js"></script>
</head>

<body>

Content loading, please stand by. <br>
If the page does not load or you would like to skip the preload, <a href="home.html">[Click here]</a>

</body>
</html>

2) home.html
Code: [Select]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
Load is complete!!<br>
Make this your MAIN or HOME page.
</body>
</html>

3)Preloader
Code: [Select]
// A "True" Preloader
// Written by: Randy Girard - April 2003
// You are free to redistribute or edit this code in
// any way as long as this notice stays intact.

//Q: How igsactly does this method of preloading things work?
//A: This script makes a hidden layer, then prints html code
//   inside of the layer. An event (onload) is then setup
//   to redirect to the next page when loading is complete.
//   So, the browser loads the images and saves them into
//   your temporary internet files. As you continue through
//   the site, there is no wait for pictures or flash movies
//   to load.
//   This can be customized to preload close to anything!! (wav's, midi's, probly even mp3's!!)

//I do not recommend having any images on your "loading" page

var DoRedirect = "true"; //set this to "true" to redirect when completed loading, other values will be considered false (case sensitive)
var RedirectTo = "home.html"; //This is the page we will navigate to once the load is complete (this may be case sensitive, depending on the server it is hosted on)
var AmmountPreloads = 3; //How many things do you have to preload?

//Don't edit the below line of code!!
var imgArray = CreateArray(AmmountPreloads + 1,2);


//Edit the variable "AmmountPreloads" and the below lines to customize what is preloaded.
imgArray[1][0] = "Graphic1.gif"; //Path to what we are preloading
imgArray[1][1] = "image"; //Tell the script how to preload it
imgArray[2][0] = "Graphic2.jpg"; //Path to what we are preloading
imgArray[3][0] = "Graphic3.bmp"; //Path to what we are preloading

//Q: Why did I not tell the script how to preload most of the images?!
//A: I just added that option... if it is undefined, the script uses
//   the last one which was used. example, if you have 3 images you
//   want to preload, you only need to tell the script the first
//   one is an image (like done so above). This also works with the
//   flash movies.


//This is how u load flash movies
// imgArray[4][0] = "flashmovie1.swf"; //Path to what we are preloading
// imgArray[4][1] = "flash"; //Tell the script how to preload it
//WARNING: Unlike images, if the flash movie does not exist, the page will not finish loading!!
//         (or will atleast take a loooooooooong time)


//Do not edit anything below this comment!!

//This function creates 2 dimension arrays
function CreateArray(dim1) {
if (CreateArray.arguments.length == 1) {
return new Array(dim1);
} else {
var multiArray = new Array(dim1)
for (var i = 0; i < dim1; i++) {
multiArray[i] = new Array(CreateArray.arguments[1]);
}
return multiArray;
}
}

//This will print a hidden DIV layer for us to preload our stuff on.
window.document.write("<div id='preloadLayer' style='position:absolute; left:0px; top:0px; width:0px; height:1px; z-index:1; visibility: hidden;'>");

//Loop through all of our things to preload
var LastType = "";
for (loop = 1; loop < imgArray.length; loop++) {
var PrintString = "";
var CheckType = "";

//Check to make sure the path to what we are preloading exists
if ( imgArray[loop][0] ) {
//Check if it is an image type of load
if ( imgArray[loop][1] == "image" || (!imgArray[loop][1] && LastType == "image" )) {
//A simple image code is written to the page
PrintString = "<img src='" + imgArray[loop][0] + "'>";
//Check if it is a flash type of load
} else if ( imgArray[loop][1] == "flash" || (!imgArray[loop][1] && LastType == "flash" )) {
//Again, a pretty simple flash code is written to the page
PrintString = "<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0'> <PARAM NAME=movie VALUE='" + imgArray[loop][0] + "'> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#000000> <EMBED src='" + imgArray[loop][0] + "' quality=high bgcolor=#000000 ALIGN='' TYPE='application/x-shockwave-flash' PLUGINSPAGE='http://www.macromedia.com/go/getflashplayer'></EMBED></OBJECT>";
//Self explanitary ^_^
} else {
//O NO!! The type of load they specified is not supported!! Lets alert the user
alert("Preload Warning: File type '" + imgArray[loop][1] + "' is not supported!! Keep in mind this is Case-sensitive!!");
}
//If this loop has a type, lets set the LastType variable
if ( imgArray[loop][1] ) { LastType = imgArray[loop][1]; } }

//Lets print the string we have generated. if there isn't one, just a new line is printed.
window.document.write("<br>" + PrintString);
}

//We're done printing out our stuff, so we need the closing tag for the div layer:
window.document.write("</div>");


//This function will redirect to the page specified at the top of this script
function Redirect() {
    window.location.replace(RedirectTo);
}

//Now lets set an event so that once the page fully loads, we will redirect to the next page.
//Also added an option to cancel the redirect.
if ( DoRedirect == "true" ) {
window.onload = Redirect;
}



Oh, also there is one gif file :) The animated sandclock



Is it possible to integrate this script into 4images v1.7.1

One more time I explain, because I am afraid that you could not understand everything, (of poor english:)

So, I for examaple I have flash game in swf format and thumbnail in jpg format uploaded at my page.
Now, when people press the thumbanil he gots to play flash game.
Now i want to make that when people press thumbnail he gets gif(better html) file to view for 5-7 seconds and then the game.


Please hrlp,

Thank you.

Offline mawenzi

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: Loader before every file
« Reply #7 on: November 19, 2005, 12:49:32 PM »
Anzeige eines Loaders bevor das Bild geöffnet wird

Habe die Sache mal für das Vorladen der Bilder (nicht der gesamten Seite!) getestet und hier das Ergebnis.
Was ist zu tun :

Öffne : templates/<dein_template>/media/jpg.html und verwende den folgenden Code.
Code: [Select]
<!-- Template file for JPG Files -->
<SCRIPT>
    load_img = new Image();
    load_img.src = '{media_src}';

    function replace_img(){
        if (load_img.complete) {
            document['target_img'].src=load_img.src;
            clearInterval(timerid);
        }
    }

    timerid = setInterval("replace_img()", 1500);
</SCRIPT>
<table border="0" cellpadding="0" cellspacing="0" >
<tr><td width="{width}" height="{height}" valign="middle" align="center"><img name="target_img" src="{template_url}/images/loader.gif" alt="{image_name}" />
</td></tr></table>

wobei :
  • timerid = setInterval("replace_img()", 1500); - Hier die Zeit des Vorladens einzustellen wäre.
  • src=" {template_url}/images/loader.gif" - Das die Grafik ist, die als Loader angezeigt wird.
  • die Layout-Anpassung an dein Template natürlich deine Sache ist.
  • dieser Loader auch für jedes andere Media-Element verwendet werden könnte ... (swf-files ... ?) .
  • die Umsetzung für Flash-Files so wohl nicht funktioniert, da über <param name="movie" value="{media_src}">
    die Flash-Datei geladen wird und so kein Ersetzen des "scr" mittels o.g. "java-script" möglich ist ...  :?

mawenzi

Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline zaisk

  • Jr. Member
  • **
  • Posts: 93
    • View Profile
Re: Loader before every file
« Reply #8 on: November 19, 2005, 12:56:03 PM »
Thanks, but I need not for JPG but for SWF (Flash files) and if you could, please write in english, becasue I have to translate everything with BableFish, if you can't then I will translate.

So could the same thing will be done for flash files?

Offline zaisk

  • Jr. Member
  • **
  • Posts: 93
    • View Profile
Re: Loader before every file
« Reply #9 on: November 19, 2005, 01:30:49 PM »
I am trying to make everything by myself, but now I have one more question.

Now everything whould goes in this way:
Thumbnail---->Html with advertisement(Made of default/media/swf.html)--->Preloader.js----->default/media/swf2.html (I created that file, but still not working for me).

Now I will try to explain: From original swf.html file I made advertisement(loading) file witch redirects to preloder.js file and stops the swf.html file for the some time, then preloader.js file redirects to the swf2.html, which should open the flash game. (but still not working for me)

Here is my question: How to make that all this way till swf2.html file the {media_src} will be ok, and when preloader.js redirects to swf2.html the flash game will successfully open?

Please help me. Sorry for bad english

Offline mawenzi

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: Loader before every file
« Reply #10 on: November 19, 2005, 02:08:18 PM »
swf.html is a "bit-html-file" that is needed to build a complete (static) site by details.php.
you can't change the swf.html by swf2.html in a complet-static-details-site by a java-script.
(maybe ... that is possible by using of iframes ...?)

mawenzi
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline zaisk

  • Jr. Member
  • **
  • Posts: 93
    • View Profile
Re: Loader before every file
« Reply #11 on: November 19, 2005, 02:12:41 PM »
What I have to change that between thumbnail and flash file will apear html page with advertisement for 5-7 seconds ???

Offline beroshima

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: Loader before every file
« Reply #12 on: December 29, 2007, 07:42:33 PM »
Hi,

mir ist aufgefallen, evtl. anderen auch, das der code:

Code: [Select]
<!-- Template file for JPG Files -->
<SCRIPT>
    load_img = new Image();
    load_img.src = '{media_src}';

    function replace_img(){
        if (load_img.complete) {
            document['target_img'].src=load_img.src;
            clearInterval(timerid);
        }
    }

    timerid = setInterval("replace_img()", 1500);
</SCRIPT>
<table border="0" cellpadding="0" cellspacing="0" >
<tr><td width="{width}" height="{height}" valign="middle" align="center"><img name="target_img" src="{template_url}/images/loader.gif" alt="{image_name}" />
</td></tr></table>

beim Firefox Browser, das zu Ladende Bild mit der rechten Seite überlappen lässt.
Gibt es dafür eine Lösung  :?: