Re: Daily pic problem



On Sep 20, 3:45 pm, Jerry Stuckle <jstuck...@xxxxxxxxxxxxx> wrote:
shror wrote:
Hi every body,
am trying to create a php script that get a daily picture but am
having a problem with that,

here is the code am using:

<?php

  $date = date("Y-m-d");
  echo "";
  $ext = ".jpg";

 $photo = "/DailyPic/photos/thumbs/$date". $ext ;
    switch ($photo){
        case "file_exisits ($photo)":
                echo "<a href='/DailyPic/photos/$date". $ext ."'>";
                echo "<img src='";
                echo "/DailyPic/photos/thumbs/$date". $ext ;
                echo "'></a>";
                break;
        default:
                echo "<a href='/DailyPic/photos/default.jpg'>";
                echo "<img src='";
                echo "/DailyPic/photos/thumbs/default.jpg";
                echo "'></a>";
                break;
}
?>

what I get is the default image only so I need some help please.

Thanks for and support given in advance
shror

 >>> switch ($photo){
 >>>>> case "file_exisits ($photo)":

Doesn't work.  $photo is a string (filename) and is not equal to the
result from file_exists (true/false) value.  And I think you had a typo
in transcribing your code :-).

Why use a switch statement here, anyway?  Just us

if (file_exists($photo)) ...

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@xxxxxxxxxxxxx
==================

Thanks Jerry for your quick response, but I have tried the if
(file_exists ($photo)) and its also giving me the default image

here is the code I used:

<?php

$date = date("Y-m-d");
echo "";
$ext = ".jpg";

$photo = "/DailyPic/photos/thumbs/$date". $ext ;
if (file_exists ($photo)){
echo "<a href='/DailyPic/photos/$date". $ext ."'>";
echo "<img src='";
echo "$photo" ;
echo "'></a>";
}
else {
echo "<a href='/DailyPic/photos/default.jpg'>";
echo "<img src='";
echo "/DailyPic/photos/thumbs/default.jpg";
echo "'></a>";
}
?>

thanks any way for any support supplied
shror
.



Relevant Pages

  • Re: Dropping packets
    ... 445Mbps which never drops a packet, the other has a combined tx/rx ... loops on the switch? ...   Hardware is Gigabit Ethernet, ... in and bytes out) for all ports. ...
    (comp.dcom.sys.cisco)
  • Re: Anyone ever try to fix a heat/AC swtich (in dash)
    ... The switch to control heat, defroster, and AC has been on ...   Now ... The lower 3 speeds stopped working all at once long ...
    (rec.autos.tech)
  • Re: Anyone ever try to fix a heat/AC swtich (in dash)
    ... The switch to control heat, defroster, and AC has been on ...   Now ... sure if the heater core and AC are working, ...
    (rec.autos.tech)
  • Re: 8085 SBC needs help
    ... When the switch is making, the LED will flash at about 1Hz. ... delay1: lxi     d,h'ffff ... dloop1: nop ... SOme correction was made after the DCX D. ...
    (sci.electronics.basics)
  • Re: *Expelled* writer admits he opposes the entire foundation of
    ...    detonation of the atmosphere into hydrogen fusion. ... controversial when the guys that perpetrated the scam are running the ... bait and switch on anyone that believed them about the ID scam. ... had started to run the bait and switch on their own supporters. ...
    (talk.origins)