Jump to content

Photography site


Seglespaan

Recommended Posts

Hi,

 

I've been asked to create a site for a photographer, but theres a few areas I'm not sure about.

 

The Brief states that the photgrapher should be able to upload images of a wedding for example, these will be automatically resized and copyrighted and will also to be specific to the user (who wedding it is)

 

So when these are uploaded whats the best way to first of all sort / store these photos and then how woul the user only view the photo's specific to them?

 

also anyone know how to automatically copyright these? the guy doesn't want a watermark,

 

Cheers

 

 

Link to comment
https://forums.phpfreaks.com/topic/125022-photography-site/
Share on other sites

1: Store the images on the file system, not inside a database.

2: Store the directory of each each image in a database.

 

So for example, you could have a table called images:

 


mysql_query("

CREATE TABLE images(
image_id INT(11) NOT NULL AUTO_INCREMENT,
image_title TEXT,
image_directory TEXT,
PRIMARY KEY(image_id))") or die(mysql_error());

 

how woul the user only view the photo's specific to them

 

What do you mean?

 

The site should state that all photos are protected under copyright. (There's no form to fill in  ;D)

 

Link to comment
https://forums.phpfreaks.com/topic/125022-photography-site/#findComment-646053
Share on other sites

ok so I would have a folder called images where every image would reside, then have my image table in the database. I can then have another field called "user", so when Mr Smith logged in the page would only display photo's that have the user set to MrSmith?

 

is that what u mean?

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/125022-photography-site/#findComment-646063
Share on other sites

Well in that case:

 

mysql_query("

CREATE TABLE images(
image_id INT(11) NOT NULL AUTO_INCREMENT,
user_id INT(11) NOT NULL,
image_title TEXT,
image_directory TEXT,
PRIMARY KEY(image_id))") or die(mysql_error());

 

Place the id of the user in the column user_id.

 

Then maybe perform a query like so to get images for a specific user:

 

$user_id = 1; //Example. In reality, you'd be getting this from a table called users or something
$select_photos = mysql_query("SELECT image_id,image_title,image_directory FROM images WHERE user_id = '$user_id'") or die(mysql_error());

 

Link to comment
https://forums.phpfreaks.com/topic/125022-photography-site/#findComment-646069
Share on other sites

Here is a basic version of doing this. There are better ways, and this method ends up creating an empty row at the end, but hopefully you get the point of it.

 

<?php
$num_cols = 5;// set our number of columns
$num_images = 50; // this is a made up number to give us 50 cells at 5 wide by 10 high.
$x = 0; // initialize a counter
$col_count = 1; // initialize a column counter
?>
<table width="70%" border="1" cellpadding="10" cellspacing="0" >
<tr>
<?php

while($x < $num_images)
{
echo '<td>Cell '.($x+1) .'</td>';// print the table cells
if($col_count == $num_cols) // if $col_count is equal to $num_cols
{
	echo '</tr><tr>'; //close the row and start a new one
	$col_count=0; //  reset our counter to 0 as we are going to bump it to 1 before this loop completes
}
$col_count++; // increment our col_counter
$x++; // increment our main counter variable
}

?>
</tr>
</table>

 

Nate

Link to comment
https://forums.phpfreaks.com/topic/125022-photography-site/#findComment-646227
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.