/    Sign up×
Community /Pin to ProfileBookmark

Remove one image From a folder

hi friends………………

In “images” folder multiple images are there. if first image will display in website then another image will load it by using webcam so last loaded image will display now but previous image want to delete how it should write code in php.

thanks
senthu

to post a comment
PHP

6 Comments(s)

Copy linkTweet thisAlerts:
@senthuauthorJan 09.2007 — hi friends.............

In the below code its not automatically refreshing why?


Here is my code

[code=php]<html>
<head>
</head>
<body onLoad="startTime()">
<img src="" name="bn" height="300" width="458">
</body>
</html>
<script type="text/javascript">
function startTime()
{

var desc="D:\wamp\www\hi\pict\WebCam Center\Remote Monitoring\20070104\";

var x="<?php if ($handle = opendir('D:/wamp/www/hi/pict/WebCam Center/Remote Monitoring/20070104/'))
{
while (false != ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
$str.=$file." ";
$pieces = explode(" ", $str);
}
}
$count=count($pieces);
$count=$count-1;
$pieces=array_slice($pieces, 0, $count);
$rand_keys = array_rand($pieces, 1);
echo $pieces[$rand_keys];

}?>";
//alert(x);

var desc=desc + x;
document.images.bn.src=desc;
setTimeout('startTime()',500);
}

startTime();
</script>[/code]
Copy linkTweet thisAlerts:
@bathurst_guyJan 09.2007 — You don't make any sense. Use some grammar and explain yourself clearer.
Copy linkTweet thisAlerts:
@senthuauthorJan 10.2007 — hello friends if u know answer reply to this thread otherwise leave it.
Copy linkTweet thisAlerts:
@NightShift58Jan 10.2007 — [code=php]<?php
if ($handle = opendir('D:/wamp/www/hi/pict/WebCam Center/Remote Monitoring/20070104/')) {
while (false != ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
$str.=$file." ";
$pieces = explode(" ", $str);
}
}
$count=count($pieces);
$count=$count-1;
$pieces=array_slice($pieces, 0, $count);
$rand_keys = array_rand($pieces, 1);
$thisPIECE = $pieces[$rand_keys];
}

print "<html>";
print "<head>";
print "<script type='text/javascript'>";
print "function startTime() {";
print "var desc = 'D:\wamp\www\hi\pict\WebCam Center\Remote Monitoring\20070104\';";
print "var x = '$thisPIECE';";
print "//alert(x);";

print "var desc=desc + x;";
print "document.images.bn.src=desc;";
print "setTimeout('startTime()',500);";
print "}";
print "startTime();";
print "</script>";
print "</head>";

print "<body onLoad='startTime()'>";
print "<img src='' name='bn' height='300' width='458'>";
print "</body>";

print "</html>";
?>[/code]
This is the functional equivalent of the code you posted. This means that this code, too, will not work the way you want it to. But with this version, you might be able to see why not...

[B]Order of things:[/B]

1. PHP starts and finishes, server-side

2. HTML output is sent to browser and loads

3. If there's any javascript, browser will run it
Copy linkTweet thisAlerts:
@NightShift58Jan 10.2007 — hello friends if u know answer reply to this thread otherwise leave it.[/QUOTE]I hadn't seen that. If I had, I wouldn't have answered... The man is trying to help and he's right when he says that you're not being very clear about your needs. You probably should apologize...
×

Success!

Help @senthu 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.19,
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,
)...