Kemmeo Posted May 26, 2011 Share Posted May 26, 2011 Hey guy, first of All thanks for given this topic a go and replying to it Now, I new to the whole php scene and I only know some of the basics, yet I foolishly Try to compile a script that Will allow users ón my page to upload a title, a link and an image To my mysql server and then displaying All images in the database on the index page resized in table Any suggestions or examples are welcome and would be much appreciated Thanks in advance - kemmeo Quote Link to comment Share on other sites More sharing options...
eMonk Posted May 26, 2011 Share Posted May 26, 2011 I'm new myself and would suggest buying a php/mysql book to at least the basics. There's a bunch of exercises you can find online too. Quote Link to comment Share on other sites More sharing options...
eMonk Posted May 27, 2011 Share Posted May 27, 2011 Here's some sites that can help you get started: http://www.tizag.com http://php.about.com http://www.w3schools.com Here's a site where you might find examples of what you're looking for: http://www.hotscripts.com Quote Link to comment Share on other sites More sharing options...
Kemmeo Posted May 27, 2011 Author Share Posted May 27, 2011 Thanks a ton man xD I'll look at the links and try my luck there Other Replies are still welcome Quote Link to comment Share on other sites More sharing options...
jcbones Posted May 27, 2011 Share Posted May 27, 2011 Please don't use w3schools, they have a lot of outdated, and/or false information. Quote Link to comment Share on other sites More sharing options...
Jacbey Posted May 27, 2011 Share Posted May 27, 2011 Please don't use w3schools, they have a lot of outdated, and/or false information. I completely agree, but for simple stuff, for example: learning basic syntax, it is fine. Quote Link to comment Share on other sites More sharing options...
Jacbey Posted May 27, 2011 Share Posted May 27, 2011 Hey guy, first of All thanks for given this topic a go and replying to it Now, I new to the whole php scene and I only know some of the basics, yet I foolishly Try to compile a script that Will allow users ón my page to upload a title, a link and an image To my mysql server and then displaying All images in the database on the index page resized in table Any suggestions or examples are welcome and would be much appreciated Thanks in advance - kemmeo If you want I can make a script to do this for you? But I recommend you upload the image to a folder on your server but put a record of the name of the image into a field in the table in the database. I have always found this easier than storing images in the actual database. Quote Link to comment Share on other sites More sharing options...
Kemmeo Posted May 27, 2011 Author Share Posted May 27, 2011 Wow Jacbey, you will? ^^ That's almost too awesome to be true I'd be really glad if you found the time to make the script for me, and please, if it's easier for you to just make the images go in a folder, by All means make Them dó that (: I Think it's really awesome you guys reply this quickly. Thanks a lot everyone! Quote Link to comment Share on other sites More sharing options...
Jacbey Posted May 27, 2011 Share Posted May 27, 2011 Sure I will, it'll get me out of bordom. So you want a script that. Upload a title for an image, a link (what's the link for?), upload image to server, upload link to image to database? Anything else? Quote Link to comment Share on other sites More sharing options...
Kemmeo Posted May 27, 2011 Author Share Posted May 27, 2011 That's really cool of you to be specific, I'm asking for a script that; Allows users to Uploads an image, give the image a title, and a link. and then; Display all images from the folder on index.php image must be clickable with the user specified link. the images must be resized to Width 214 and Height 317 and be in a table with 4 columns and unlimited rows. The whole Idea behind my need for this script is that I want to make a site where people can promote their art. so they upload their paintings, photo's whatever with a link to their website in it. so that when people see a painting they like they can click it and get taken straight to the artist's website or a place they can buy the painting. I hope I'm not demanding too much, and I'd really appreciate it if you could make this script for me Quote Link to comment Share on other sites More sharing options...
Jacbey Posted May 27, 2011 Share Posted May 27, 2011 naww, that's cool. I can do that. Give me an hour or so. Are there any database table specifics you want me to include to make it easier for you? Like table / database names? Quote Link to comment Share on other sites More sharing options...
Kemmeo Posted May 27, 2011 Author Share Posted May 27, 2011 eeeehm.. Database is called art and the table is called gallery. but I thought you said you wanted to store the files in a folder and not a mysql database? Quote Link to comment Share on other sites More sharing options...
KevinM1 Posted May 27, 2011 Share Posted May 27, 2011 eeeehm.. Database is called art and the table is called gallery. but I thought you said you wanted to store the files in a folder and not a mysql database? It's easier to save images on the disc, in folders, than it is to save them in a db. All your tables need is a column specifying the path to the image. Quote Link to comment Share on other sites More sharing options...
Kemmeo Posted May 27, 2011 Author Share Posted May 27, 2011 Wow cool^^ A Mod on my tread thanks for clearing it up for me Quote Link to comment Share on other sites More sharing options...
cssfreakie Posted May 27, 2011 Share Posted May 27, 2011 if you want an easy to understand and even a fun book, Head first php & mysql is really nice. lots of pictures puzzles examples and little tests. Just like you follow a course from a cool teacher. Try it! (if your totally new that is) Quote Link to comment Share on other sites More sharing options...
Kemmeo Posted May 27, 2011 Author Share Posted May 27, 2011 COOL a Guru^^ I'll definitely read the book, thanks for the suggestion Quote Link to comment Share on other sites More sharing options...
Kemmeo Posted May 27, 2011 Author Share Posted May 27, 2011 COOL a Guru! yeah I'll definitely give the book a try thank you for the suggestion ^^ Quote Link to comment Share on other sites More sharing options...
Bl4ckMaj1k Posted May 27, 2011 Share Posted May 27, 2011 http://www.developphp.com/list_php_video.php The videos on that website made me the PHP semi-ok dude that I am today. I can now bang out exactly what you are asking for in about 2-3 hours...if even that long. You are creating 3 pages, 2 tables, and a directory for each individual user. I would make one index page which displays every image in the system, another page for user specific images, and a final page for a users profile. Tables would be 1 for contact/profile information and another to hold the data for the uploaded art. Once you go through the site I just posted and review the videos, you should be good to go. The guy teaching the stuff is extremely thorough and assumes anyone looking at the videos are EXTREMELY dumb lol. At times you will find yourself sighing at how lower-level he takes some of his explanations, but other times you will appreciate his sense of depth. Good luck!! P.S. I wish the project I am working on was something a bit more simple. For a first project, I think I went a bit too complex. Quote Link to comment Share on other sites More sharing options...
Kemmeo Posted May 27, 2011 Author Share Posted May 27, 2011 Hey Bl4ckmajik thanks for the link, extremely useful! The website that I'm making will only consist of a few pages though and the structure's a lil different then what you describe. there's going to be an Index page with all the uploaded artwork in sorted by date. then there's going to be an upload page and an about us page. that's it no member area, no registration and no logins, cause artist's hate that sort of thing Quote Link to comment Share on other sites More sharing options...
Bl4ckMaj1k Posted May 27, 2011 Share Posted May 27, 2011 Hey Bl4ckmajik thanks for the link, extremely useful! The website that I'm making will only consist of a few pages though and the structure's a lil different then what you describe. there's going to be an Index page with all the uploaded artwork in sorted by date. then there's going to be an upload page and an about us page. that's it no member area, no registration and no logins, cause artist's hate that sort of thing That's awesome!!! I do a bit of artistry myself and I must say, you are quite correct when you say WE DESPISE LOGGING IN!!!! LOL The artwork being sorted by date, all displayed on one page is not bad. Its going to come down to the way you display everything. I hate tables so I suggest you use divs and float them all left. This way, if you size it correctly, the line breaks will happen automatically. For example, if your container div is 100 and each image container is only 20, then you will have 5 images in each row. Make sure the image div and image display is inside the while loop so you only have to type it once. $display_images = ''; while ($row = mysql_fetch_array($someSql)) { $image_name = $row['image_name']; $display_images .= '<div class="images"> <img src="images/' . $image_name . ' /> </div> } Then, in the page body, you would echo this out to display your divs. Make sure the class 'images' is sized properly and floating to the left. <div id="image_container"> <?php echo "$display_images" ?> </div> Lastly, make sure the ID image_container is whatever will generate a perfect number for your images. For example if you want 10 images to display per row, then make sure this is big enough for exactly 10 images. Assuming 20px width of each image, to have 10 images you need a div of EXACTLY 200px (10images * 20px each). You will also want to make sure you date stamp all your uploaded artwork using either the function 'now()' or the date() function. Also when setting up your database be sure to use Date datatypes because you will need to perform date math when sorting by most recent date. The about us page should be pure HTML so thats a breeze. I will say, if users don't have to be logged in to upload things, then hackers could find your site and attempt an attack. Ensure nothing but image files can be uploaded which can be done using something like this... $allowed = array("image/jpeg", "image/gif", "application/pdf"); if(!in_array($file_type, $allowed)) { //some error } Bl4ck Maj1k Quote Link to comment Share on other sites More sharing options...
Kemmeo Posted May 27, 2011 Author Share Posted May 27, 2011 Wow this was really helpful. Thanks so much I'll see into it so you're an artist yourself? what u do? painting, photos etc? Quote Link to comment Share on other sites More sharing options...
Bl4ckMaj1k Posted May 27, 2011 Share Posted May 27, 2011 I'm a visual poet. I am sure I don't need to explain this but that's when your poems are intertwined with imagery...its a method of expressing what you say and depicting what you see as you say it. A lot of artists (painters and poets) lack the ability to put what they do into either imagery (poets) or words (painters). The real message is truly found when you turn those images into words or vice versa. Quote Link to comment Share on other sites More sharing options...
Kemmeo Posted May 27, 2011 Author Share Posted May 27, 2011 that's cool I'm a painter myself. so if you want I'll be sure to send you a link when the site is finished so you can upload some pics Quote Link to comment Share on other sites More sharing options...
Bl4ckMaj1k Posted May 27, 2011 Share Posted May 27, 2011 Sounds good, yea I would love that!!! Quote Link to comment 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.