Anxious Posted April 28, 2009 Share Posted April 28, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/155997-uploading-images-image-albums-profile-photo-database/ Share on other sites More sharing options...
gamerzfuse Posted April 28, 2009 Share Posted April 28, 2009 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 ? Quote Link to comment https://forums.phpfreaks.com/topic/155997-uploading-images-image-albums-profile-photo-database/#findComment-821179 Share on other sites More sharing options...
shlumph Posted April 28, 2009 Share Posted April 28, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/155997-uploading-images-image-albums-profile-photo-database/#findComment-821180 Share on other sites More sharing options...
Anxious Posted April 28, 2009 Author Share Posted April 28, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/155997-uploading-images-image-albums-profile-photo-database/#findComment-821301 Share on other sites More sharing options...
Anxious Posted April 29, 2009 Author Share Posted April 29, 2009 Anybody? Quote Link to comment https://forums.phpfreaks.com/topic/155997-uploading-images-image-albums-profile-photo-database/#findComment-821609 Share on other sites More sharing options...
shlumph Posted April 30, 2009 Share Posted April 30, 2009 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? Quote Link to comment https://forums.phpfreaks.com/topic/155997-uploading-images-image-albums-profile-photo-database/#findComment-822371 Share on other sites More sharing options...
Anxious Posted May 1, 2009 Author Share Posted May 1, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/155997-uploading-images-image-albums-profile-photo-database/#findComment-823307 Share on other sites More sharing options...
shlumph Posted May 2, 2009 Share Posted May 2, 2009 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? Quote Link to comment https://forums.phpfreaks.com/topic/155997-uploading-images-image-albums-profile-photo-database/#findComment-823882 Share on other sites More sharing options...
Anxious Posted May 2, 2009 Author Share Posted May 2, 2009 I have posted another thread, with problems on what I'm doing.. but the problem I find atm is that its not registering me. Quote Link to comment https://forums.phpfreaks.com/topic/155997-uploading-images-image-albums-profile-photo-database/#findComment-824073 Share on other sites More sharing options...
shlumph Posted May 2, 2009 Share Posted May 2, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/155997-uploading-images-image-albums-profile-photo-database/#findComment-824240 Share on other sites More sharing options...
Anxious Posted May 2, 2009 Author Share Posted May 2, 2009 Here. http://www.phpfreaks.com/forums/index.php/topic,250454.0.html Quote Link to comment https://forums.phpfreaks.com/topic/155997-uploading-images-image-albums-profile-photo-database/#findComment-824365 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.