/    Sign up×
Community /Pin to ProfileBookmark

Image Preload Crashing

Using the following to force cache images on page, throws error and dies without grace.
At first I thought it wasn’t reading the directory but, it seems like its there (judging from
first error). I was thinking that maybe it had something to do with $diro=pictures/ ???
No idea…. I tried echoing array at the end of my while string and just gave me another
error….. It all “Seems” vaild.

[code]
<?php
$hds=”images/products/lighting/”;
$src=”images/products/lighting/pearl/”;
$img=”images/products/lighting/pearl/searchlight/”;
$url=”layers/lighting/pcons/”;
$noimg=”images/”;

$dir = dir($img);
while($temp = $dir->read())
{
$dirarray[] = $temp;
}
print j_array($dirarray);

function j_array($var){
$javastr = “<script language=”javascript”>”;
$javastr .= “var d = new Array();”;
$diro=”Pictures/”;

while(list($key, $val) = each($var)){
$javastr .= “d[$key] = new Image();”;
$javastr .= “d[$key].src = ‘$diro$val’;”;
}
$javastr .= “</script>”;
return $javastr;
}
?>
[/code]

And Error

[quote]

Warning: dir([url]http://omnisistem/images/products/lighting/pearl/searchlight/[/url]) [function.dir]: failed to open dir: not implemented in /home/content/o/m/n/omnisistem/html/layers/lighting/prl-sl.php on line 8

Fatal error: Call to a member function on a non-object in /home/content/o/m/n/omnisistem/html/layers/lighting/prl-sl.php on line 9

[/quote]

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@zahidrafMar 10.2009 — check your img path is right

line 9 error is due to line 8 as it is not passing data to next function


Mac Book Wheel
Copy linkTweet thisAlerts:
@ehimeauthorMar 10.2009 — check your img path is right

line 9 error is due to line 8 as it is not passing data to next function


Mac Book Wheel[/QUOTE]


Image path is right "I believe", unless it needs to recurse to root before it

travels back up to said image directory, I'd actually thought about that, but

couldn't get it to do $server[local_etc] + $img. All images in that document

are using the value from $img, so it should technically be right? Like I said,

the only thing I could think of was if needed to go root before traversal....
Copy linkTweet thisAlerts:
@zahidrafMar 10.2009 — Did you try to see put the bath in browse and see are you able to see the images or not ?
Copy linkTweet thisAlerts:
@ehimeauthorMar 10.2009 — Yep, I even tried using an absolute path for the variable, aka
<i>
</i>http://omnisistem.com/images/products/whatever/


No dice....?
Copy linkTweet thisAlerts:
@ehimeauthorMar 10.2009 — Up,

Anyone have a image caching script I can include per-page? We

have a lot of images in four different states 20x20 50x50 170x170

and 540x540 I'd really like to load the 170's in the background as

all the 20's in the foreground. Makes my mouseovers less jerky as

well as less prone to 5 second stall outs while its loading images.
×

Success!

Help @ehime spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.22,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...