|
|
|
|
Like this code?
Show the author your appreciation.
|
|
| |
This script is taking a directory of images with the filename structure "galleryname_1.jpg",
"gallery_2.jpg" ... and creates subdirectories based on the first part of the image filename.
So an image file with the name "bulldozer_1.jpg" would cause the script to check for the
directory "albums/bulldozer/". If it doesn't exist, it'll create it. If it exists, it will
check whether the file exists already in the directory. If it doesn't, it'll copy it to the
"bulldozer" directory.
This way you can upload your image files in one directory after having them renamed with your
windows OS or whatever and distribute them into single albums.
| <?
/*
This script has been programmed by Christian Haensel, chris@chftp.com. LINK1http://www.chftp.comLINK1
Please do not remove this information.
If you like this script, please let me know and/or link to my website from your website.
*/
// Name of the directory where the source images reside that you wanna put in place.
$tmpdir = "imgtmp";
// Create folders if not existant
function createdir($checknr) {
mkdir("albums/".$checknr, 0777);
chmod ("albums/".$checknr, 0777);
echo "<p>DIR <b>".$checknr."</b> created<br>";
}
// Check if the image already exists. Otherwise copy it into the directory
function check_image($checknr, $filename) {
if(file_exists("albums/".$checknr."/".$filename)) {
echo " File ".$filename." exists";
} else {
copy('imgtmp/'.$filename, "albums/".$checknr."/".$filename);
echo " File ".$filename." copied";
}
}
// Check if the image folder exists
function checkfolder($check, $movefile) {
if(!is_dir("albums/".$check)) {
createdir($check);
check_image($check, $movefile);
} else {
check_image($check, $movefile);
}
}
// Run through the source folder
$folder = opendir($tmpdir);
while($file = readdir($folder)) {
if(!is_dir($file)) {
$checkfile = explode("_", $file);
$checknr = $checkfile[0];
checkfolder($checknr, $file);
echo "<br>";
}
}
?> | | |
|
| This is a simple photo gallery that reads the image files from multiple directories, and generates a web page styled with CSS1. It opens single auto window to view and print a given image.
Categories : Graphics, Filesystem, PHP, Complete Programs | | | Random Image Display Categories : PHP, Filesystem, Graphics, HTML and PHP | | | Easy slideshow with php. Just place this one file into a subdirectory where jpg files reside. An instant slideshow is yours. MS explorer only. Categories : PHP, Filesystem, Graphics | | | This program implements hot link prevention in php. It is useful for webmasters who do not have access to the server at a level where they can control hot linking can still supply some type of hot link prevention for thier site by using php. Categories : PHP, Filesystem, Graphics, Content Management | | | This script will read all images from a folder and read the files into an array. It uses rand() to get a random number. It will display a random image from the image folder given. Categories : PHP, Arrays, Graphics, Filesystem | | | Simple image counter Categories : PHP, Graphics, Filesystem, Beginner Guides | | | Simple class that uses GD to draw pie charts. After the class definition there's some sample code to demonstrate how you use the class.
Categories : Graphics, PHP, PHP Classes, GD image library, Charts and Graphs | | | PHP4 DirectoryIterator Class Categories : PHP, PHP Classes, Filesystem, Directories | | | Keep() - maintenance function for backup folders Categories : PHP, Filesystem, Maintenance | | | Shows the current time as a PNG-image. This script does not use the GD
library. You can use it as a benchmark (because it's slow), or as a quick
reference for implementing a simple PNG-file generator. Categories : Graphics, Zlib, Calendar, PHP, Date Time | | | Contents Page - a script to build contents pages. Categories : Complete Programs, PHP, Utilities, Filesystem | | | Display list of files within current and subdirectories (recursively) showing
each file as an anchored link and each directory as a category header. Categories : Filesystem, Directories, Arrays, PHP | | | How to create an empty file? (touch) Categories : Filesystem, PHP | | | A couple of functions that convert an IP address into its color code and not-color-code. Useful when viewing an apache log with a mysql result grouped by IP Categories : PHP, Graphics, Databases | | | Simple way of scaling any image to fit either given width or height. Categories : PHP, Graphics, Arrays | |
|
|
|