So I need to delevop a little php script I can run from a cron job which in layman's terms does the follow...
If file exists with name day.jpg exists rename it to fixtures.jpg
else
copy master.jpg to fixtures.jpg
where day.jpg is the day of the month. For example on the 2nd if the file 2.jpg exists it gets renamed to fixtures.jpg
SO I start with a simple if statement
<?php
if(FILE EXISTS WITH NAME DAY.JPG) {
rename ("DAY.JPG", "fixtures.jpg");
} else {
copy ("master.jpg", "fixtures.jpg");
}
?>
so clearly there are a few things i need to add here...
Firstly I think I need to define a variable which we will call $filename which will be the name of the file which is named after the day of the month. So I think I need to say that $filename = dayofthemonth.jpg
at that point I can do the rename part as
rename ("$filename", "fixtures.jpg");
so the $filename part...
SO i guess i use something like $filename='date('j');'.jpg
any help would be greatly appreciated
Thanks
Aucun commentaire:
Enregistrer un commentaire