Hallo and happy new year!
I have no idea if the following works. But I guess, here in the forum are the best PHP programmers.
My problem:
For a nice designed page, first I load a low resolution jpg background image (loading time).
Close to the </BODY> tag, I like to ask a function every second, whether a bigger background image (same image, but high res) is already loaded in order to reload the background image. Javascript is not able to read from the cache (under IE, Netscape, Opera). Is PHP able to check, if the file is already in cache? I am not a PHP expert, so can somebody help me?
Thanks in advance.
Read files from cache! Is big size image already preloaded?
Moderator: General Moderators
No rules without certain ways to bend them. If you are producing code using a webserver on your own machine (or even intranet networked), you might have access to the filesystem of that very computer.
As I can't see how your upload.php looks and works, I cannot talk about that one. General fileuploading scripts works in a completely different way that loading images in a browser.
As I can't see how your upload.php looks and works, I cannot talk about that one. General fileuploading scripts works in a completely different way that loading images in a browser.
There are a number of ways to check if an image has loaded... but like the others say it can only be done client-side as PHP runs on the server.
A very basic way to check if any image has loaded is to use something like this...
Checking if the image already exists in the Cache though is, as far as I know, not possible.
A very basic way to check if any image has loaded is to use something like this...
Code: Select all
<head>
<script type="text/javascript">
bigImageHasLoaded = false
function checkBI()
{
if(bigImageHasLoaded)
{
alert("LOADED")
}
else
{
alert("NOT LOADED")
}
}
</script>
</head>
<body>
<img src="images/myBIGimage.jpg" onload="bigImageHasLoaded=true" alt="" />
<hr />
<a href="JavaScript:checkBI()">Check if BIG image has loaded</a>
</body>Thanks for your answer jam, and for your source gen-ik!
Its hard to realize, that NOT everything is possible! As a beginner I thought, that even PHP is able to handle this small cache problem. For webdesigner it would be a big gift to know, when a file is already loaded, already in cache. I learned "nothing is impossible, there is always a way". I am really disappointed that I failed in this case...
Anyway, thanks again!
Its hard to realize, that NOT everything is possible! As a beginner I thought, that even PHP is able to handle this small cache problem. For webdesigner it would be a big gift to know, when a file is already loaded, already in cache. I learned "nothing is impossible, there is always a way". I am really disappointed that I failed in this case...
Anyway, thanks again!