Jump to content

Uploading Images - Image Albums - Profile Photo - Database?


Recommended Posts

Anybody got any information?

 

I can easily read up about uploading images...

 

Would the image's be inserted into a database and where would I insert the caption, in a seperate column in the table, or in the same one underneath the image?

 

Image albums, so a user uploaded multiple images, how would I get them to display as a album on user profiles, as I'm guessing they'd all be in the 'photo' category on the database table, also the photo's should be included with captions they entered.. etc etc.

 

What about profile photo's, I'm guessing when a user selects a photo and clicks submit, it'll update the 'profilephoto' column, I think that'll be alright.

 

 

Can anyone give any information ,don't need to put code in, just to help me a bit more. :) Thanks.

Are you building an entire site from scratch or are you using a premade site base?

Your post has lots of information, but I am not 100% on your requirements.

 

You want to make a PHP function that will:

a) Take users photos and upload them to a site, linking to them with a database

b) Allow user to choose one image as their Display Picture, which the database will reference in a separate column

 

?

I wouldn't put the image itself in the database, but a URL to the image in the database (varchar). Also, make the caption it's own column. You're gonna want a table like this:

 

photos table:

id - int; primary key

profile_id - int; foriegn key

image - varchar(255)

caption - varchar(255)

album_name - varchar(255)

is_default - tinyint

 

Let us know if you have questions about this.

I'll have Username - varchar(30) primary key

so when a user uploads an image it knows where to put it.

 

Underneath image.. it'll have all the images in one column, how would I display them all like a photoalbum.

Just reading what you said, it has a URL.. how would that work? how would I create a URL for the uploaded image?

and then.. how would I display it, being as.. once a user has uploaded an image.. it should be displayed in the album straight away, without having me to add any more PHP in to display it.

 

gamerzfuse, I have already built the website with user profile itself, just adding in profile images.

Every image on the internet has a URL to it... you know, like http://assets0.twitter.com/images/twitter_logo_header.png ... it all depends on where you upload the image to on the server. Each profile should have their own folder, that contains their uploaded images. In the database, you store the URL to each uploaded image.. like http://www.somesite.com/images/profile_ID/image_name.jpg

 

Then, to display all the images from one person you'd do <em>something</em> like this:

<?php

$sql = "SELECT image, caption FROM photos WHERE profile_id='123'";
$rs = mysql_query($sql) or die(mysql_error);

while($row = mysql_fetch_array($rs, MYSQL_ASSOC)) {
        echo "<div>";
        echo "<img src='". $row['image'] ."' />";
        echo "<p>". $row['caption'] ."</p>";
        echo "</div>";
}

 

Does this make more sense now?

Slightly, uploading an image.. thats fine.

How does it create the URL to it though?

 

Also.. if someone was to create a photoalbum (its nessecary) how would that get the link aswell?

 

Sorry just confused, not researched much about this. I've just found about uploading 1 image. Thats it.

Anxious,

 

Where are you uploading the image to? In other words: What is your domain name, what folder are you uploading the image to, and what is the image name (and extension: jpg, gif, png, etc.)? Wherever the image uploads to ... that's the URL to the image. Does this make sense now?

I'm not sure where your other thread is.

 

It's just like uploading an image to the web server via FTP. You know, you upload the image to the server, then you go to the images web address. That web address is the images URL.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.