NameSilo

(Php) Photo Management System?

Spaceship Spaceship
Watch

Rudy

Established Member
Impact
16
Hey guys,
I'm currently building some additions to a site that I run, and I am launching into a type of project that I have never done before. I need to have a picture management system that would give a user the ability to have 1 (and only 1) picture on their web page (through my service).

It will act pretty much like uploading an avatar on any well known forum software would work: you will be able to upload your own photo, but you can also pick one from a "gallery". The photo will have size & dimension restrictions, etc...

So, I was wondering if anyone knows of any good free scripts out there, or any good PHP tutorials on this sort of thing?

I guess I could try to hack the phpBB code for managing avatars.... but that would take quite a bit of work.

Any ideas?

Thanks,
David
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
.US domains.US domains
Ok, here's what I've got so far...

This code is only working on images already on the server... I'll mess with uploading images later. This is currently not doing what I want it to do.... I'm trying to create an array of each picture, pass the array ID to my html/css/javascript which will then hide & show each div.

I'm using a javascript function next_photo_gallery() (see code below) to show & hide each individual div that I have created for each picture.

Any ideas why photos are not being displayed? I have 3 in the directory "premier_images".


Code:
<?PHP
/*
	Author: David White
	Date Started: 02/06/2007
	Description: 	This script will allow a user to browse through pictures
			in a directory to select one picture. It will place all of the contents
			in a directory into an array which will be displayed one-by-one on the click
			of a button.
*/

// Set the Directory Location
$directory = opendir('../premier_images/');

// Put every picture in the directory into an array
$output = array();
while ($picture = readdir($directory)) {
	$output[$picture] = $picture;
	echo "<div id=\"$output[$picture]\" style=\"display:none;align=center;valign=center;\">";
	echo "<img src=\"$picture\" alt=\"Gallery Photo\">";
	echo "</div>";
}
echo "
	<div id=\"$output[0]\" style=\"align=center;valign=center;\">
	<img src=\"$output[0]\" alt=\"Gallery Photo\">
	</div>
";
echo "<br /><br /><input type=\"button\" value=\"Next Photo\" onClick=\"next_photo_gallery('".current($output)."', '".next($output)."')\">";
?>

Here's the javascript functions I'm using:
Code:
<script type="text/javascript">
function display_div(id) {
	var div = id;
	var srcElement = document.getElementById(div);
	srcElement.style.display = "block"; 
    return false;
}
function hide_div(id) {
	var div = id;
	var srcElement = document.getElementById(div);
	srcElement.style.display = "none"; 
    return false;
}
function next_photo_gallery(current_id, next_id) {
	var current_id = current_id;
	var next_id = next_id;
	hide_div(current_id);
	display_div(next_id);
}
</script>
 
Last edited:
0
•••
I don't know if you've checked out Zen Photo, but its a pretty neat piece of software

http://www.zenphoto.org/

-Steve
 
0
•••

We're social

Domain Recover
DomainEasy — Live Options
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back