I have a section on my homepage that I want to display the most recent 2 or 3 pics that have been uploaded into my gallery. Does anyone know of a script that does that? Like a "recently uploaded" or "recent update" etc.
Thanks
Ryno
I have a section on my homepage that I want to display the most recent 2 or 3 pics that have been uploaded into my gallery. Does anyone know of a script that does that? Like a "recently uploaded" or "recent update" etc.
Thanks
Ryno
We can't help you unless we know how they are stored.
You just need a list of the 3 most recently updated photos that updates itself each time one is uploaded.
Or connect to your database and check...
Or.....
We need more info.
Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum
The images will probably rest in a folder in the root directory.
Yes, more along the lines of something that updates each time something is uploaded.
Hope this helps.
Ryan
The conventional way, and the way that makes the most sense, is to use a database.
Setup a PHP system that uploads the file, then stores the url of the file in a database, and then search for the latest three entires in the database.
All stuff easily available with php.
however, it sounds like you're just talking about FTP uploads.
Hmm...
I suppose the only way to do it would be to check the timestamp.
You chould check the last modified time, but that wouldn't do much good if you were using an old picture or something. I think that just using the time the file was created would work. I'm pretty sure that changes when you upload... it doesn't carry the old time from the original file. *Might* depend on the ftp app, though.
Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum
Where could I find the code if I setup a database?Originally Posted by djr33
it is a lot simpler than all that... really:
Let's say user has 5 pictures and wants to rotate a new picture every 6 hours.
1.jpg through 5.jpg would be the pic names in this example.
upload all 5 pics to the same directory on the server, lets put them in the folder named "pics"
Step 1: add the php handler to your .htaccess to allow php scripts to be executed on HTML pages:
upload this .htaccess to your /root level directory.Code:AddType application/x-httpd-php .html .htm AddHandler application/x-httpd-php .html .php .htm
Step2: open notepad and make a php page to handle all the pictures:
save this as picture.php and upoad it with the picturtes them selves.PHP Code:<?php
header("Content-Type: image/jpg");
$a = date('G');
if($a < 6) $file = "1.jpg";
else if($a < 12) $file = "2.jpg";
else if($a < 18) $file = "3.jpg";
else $file = "4.jpg";
readfile($file);
?>
Now we have 5 pictures and a picture.php in the folder named "pics"
Step 3: Where ever you want your pictures to be shown add this line to the HTML page:
That's it. You canadjust your picture.php to display 2, 3, 10 pictures at a time, and stretch it out to 12 hours, once a day, once a week, etc etc.Code:<img src= "http://yoursite.com/pics/picture.php">
No need for a database with this one![]()
{CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
Follow Me on Twitter: @InkingHubris
PHP Code:$result = mysql_query("SELECT finger FROM hand WHERE id=3");
echo $result;
That's a random image script, yes? Or... no... but a cycle based on date.
He's asking for "recent" as in recently uploaded.
For a database, look into php and mysql... here's a good tutorial--
http://php-mysql-tutorial.com
note that you need both installed on the server for it to work.
Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum
Yes, true, it is based on date, but you can make it work... just change the rotate to days or weeks instead of hours, and when you upload a new pic just change the name in the php file.
I was just giving a non-database option. Simple to do and update once it is in action.![]()
{CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
Follow Me on Twitter: @InkingHubris
PHP Code:$result = mysql_query("SELECT finger FROM hand WHERE id=3");
echo $result;
Bookmarks