xionhack Posted February 13, 2009 Share Posted February 13, 2009 Hello. I have a database with a table called "member_info" in that table is all the info about the member. I want to be able to display with the name of the member, their picture. I just dont know how to save the pictures in the database or how should I do the process of updating or inserting pictures for new members. Can somebody help me? It's the first time that I work with php/mysql and pictures. Thanks! Link to comment https://forums.phpfreaks.com/topic/145031-picture-in-database/ Share on other sites More sharing options...
sdi126 Posted February 13, 2009 Share Posted February 13, 2009 It is probably a better idea to not store the images in your database. Assuming that each member will have one picture and that your database table for members each have a unique id...then you can store the pictures on the file system and have the pictures named with their id.(ext) Link to comment https://forums.phpfreaks.com/topic/145031-picture-in-database/#findComment-761024 Share on other sites More sharing options...
xionhack Posted February 13, 2009 Author Share Posted February 13, 2009 How can I do that? How can I tell the location in the database and how can I rename the pictures if I upload a new one through the php. Thanks! Link to comment https://forums.phpfreaks.com/topic/145031-picture-in-database/#findComment-761027 Share on other sites More sharing options...
sdi126 Posted February 13, 2009 Share Posted February 13, 2009 When you upload a photo (go to the database) and grab that users unique id ( we will use this when renaming the picture ). Â Do you have the upload functionality working yet? Â With this function-----> move_uploaded_file ( string $filename , string $destination ) Â See----> http://us3.php.net/manual/en/function.move-uploaded-file.php for help you can rename the file as part of the destination string using that members unique id that you grabbed from the database. Link to comment https://forums.phpfreaks.com/topic/145031-picture-in-database/#findComment-761029 Share on other sites More sharing options...
xionhack Posted February 13, 2009 Author Share Posted February 13, 2009 Thanks! Also. What if I already have the picture in the server. How can I assign it to a user through the php? Link to comment https://forums.phpfreaks.com/topic/145031-picture-in-database/#findComment-761030 Share on other sites More sharing options...
sdi126 Posted February 13, 2009 Share Posted February 13, 2009 If it is already up there...it is probably just easier to rename it Link to comment https://forums.phpfreaks.com/topic/145031-picture-in-database/#findComment-761035 Share on other sites More sharing options...
xionhack Posted February 13, 2009 Author Share Posted February 13, 2009 I have more than 400 members! And I'm not going to be the one administering the database, so I dont know the name of everybody there Link to comment https://forums.phpfreaks.com/topic/145031-picture-in-database/#findComment-761037 Share on other sites More sharing options...
Philip Posted February 13, 2009 Share Posted February 13, 2009 How do you have the images named? Link to comment https://forums.phpfreaks.com/topic/145031-picture-in-database/#findComment-761039 Share on other sites More sharing options...
xionhack Posted February 13, 2009 Author Share Posted February 13, 2009 Some have random names, others have member_NAME.jpg Link to comment https://forums.phpfreaks.com/topic/145031-picture-in-database/#findComment-761040 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.