V Posted June 29, 2010 Share Posted June 29, 2010 Today I'll attempt to make a script that I can use to upload images to certain posts and display them. (should be fun ) I'll have a thumbnail version and a larger size version. I looked online for some tutorials but couldn't find anything good, mostly how to upload to MYSQL which I heard is a terrible idea. So I'd like to share my own idea and would greatly appreciate any kind of feedback or guidance I'm not sure if I'm approaching this right.. I already integrated a script that creates thumbnails. It puts the full sized images in a img/fullsize folder and the thumbnails in a img/thumbs folder. So I'm planning to echo the path to the thumnbail and fullsize images and insert the paths into the DB. An "images" table will have an unique ID, image_path, post_id to identify the post an image was uploaded to, and a size, for example thumb or large. So when I upload an image I'll use something like INSERT $thumb, $large, $post_id INTO images=.. bla bla bla $thumb and $large are variables of the image paths. I suppose I'll insert to DB them via ajax, on submit. and to display thumbnails for example I'll use SELECT * FROM images WHERE post_id='$post_id' AND type=thumb.. bla bla bla then echo <img src="<?php echo $thumb_file_path; ?>" alt="" /> same for large images Is it ok? :-\ Quote Link to comment Share on other sites More sharing options...
V Posted June 29, 2010 Author Share Posted June 29, 2010 update: Actually I'll insert the thumb and large image path directly in the posts table 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.