HartleySan Posted September 2, 2011 Share Posted September 2, 2011 Okay. The issue is definitely with the paths being all screwy. I apologize, but I didn't realize you were using XAMPP. I wish you had stated that before. With that said, is it safe to assume that htdocs in the XAMPP folder is set to your localhost? If so, let's imagine the following: htdocs/localhost | |--view_images (folder) | |--img (folder) | | | |--image1.jpg | |--index.html If that's your file structure, that an image would be loaded from index.html as follows: <img src="img/image1.jpg"> The following is also okay (and my preferred method): <img src="./img/image1.jpg"> Anyway, I apologize if this is all too elementary, but the point is, put everything in the htdocs folder, and make sure the paths are relative to the script referencing the images. Make sure all your paths are working and you can properly load images manually before making SQL queries to do it for you automatically. Link to comment Share on other sites More sharing options...
HartleySan Posted September 2, 2011 Share Posted September 2, 2011 I'm using IE6 at work, and I couldn't properly format that folder structure diagram. Sorry. Link to comment Share on other sites More sharing options...
Dark Prince Posted September 2, 2011 Author Share Posted September 2, 2011 even using the file inside the htdocs it still doesn't show the image I put the alt="' . $row['column'] . '" in the img tag and it will show the information from the row but not the picture the picture is stored in XAMPP/htdocs/upload/userid and still doing the same thing when I right click on the icon on the browser and hit properties it shows 2.jpg Protocol: Not Available Type: Not Available Address(URL): Not Available Size: Not Available Dimensions: 75 x 75 pixels Link to comment Share on other sites More sharing options...
Dark Prince Posted September 2, 2011 Author Share Posted September 2, 2011 somehow its not getting all the information it needs out of the file which is intact in its original state I didn't change anything of it this time in the code I just took its information and put into the uploads table in the database just for reference. so if I take the name the type and the size and put that into the database table for uploads can I take that information and make a temporary file inside the htdocs then use that file as the img src? I know larry uses urlencode when sending the file to a new window but I need to display in same window inside an html table row where the image is going to change for everyrow. Link to comment Share on other sites More sharing options...
HartleySan Posted September 2, 2011 Share Posted September 2, 2011 Two posts ago, you said you placed the info in the alt attribute. That's not going to display the image. The alt attribute is designed to explain what the image is in the event that the image cannot actually be displayed. You need to use the src attribute. If you could please give specifics, what is the EXACT relationship between the script referencing the image and the image itself (i.e., where are they relative to each other)? And what is the exact path you are pulling from the DB to load the image? Thank you. Link to comment Share on other sites More sharing options...
Dark Prince Posted September 2, 2011 Author Share Posted September 2, 2011 I used to alt attr to see if it was getting the info, but I figured it out and I'm kicking my ass for it I was using the directory path and not localhost/path so now it is working just won't let me add files using move_uploaded_file using http so that function keeps the full directory path like d:/xampp/htdocs/upload/userid Link to comment Share on other sites More sharing options...
Dark Prince Posted September 2, 2011 Author Share Posted September 2, 2011 I'll post my full script when u get back home I'm in my iPhone, that way others can learn from this mistake and avoid the headache. Link to comment Share on other sites More sharing options...
HartleySan Posted September 2, 2011 Share Posted September 2, 2011 If d:/xampp/htdocs/ (d:\xampp\htdocs\?) is equal to localhost, and your PHP script is in the htdocs folder, then <img src="./upload/user-ID/image-name.jpg">, etc. should work. Link to comment Share on other sites More sharing options...
Dark Prince Posted September 3, 2011 Author Share Posted September 3, 2011 Yeah if I run http://localhost/ in my browser it will load any page named index in there I could of set the directory wrong for the $dir token but using http://localhost/upload worked I didn't try it your way yet using ('./uploads') but I think it's because the script I'm working on is in a folder inside the htdocs folder and some reason I can only go back 1 folder in php ../../ doesn't work for going back more folders Link to comment Share on other sites More sharing options...
HartleySan Posted September 3, 2011 Share Posted September 3, 2011 I actually don't know the details for XAMPP, but you may not be able to reference files outside of the htdocs folder. Next time I use XAMPP, I will test it out. I would just assume that you can't though, and keep the images in the htdocs folder for now. You can always easily change the path at a later time for the live site. Just make sure that you get everything working first, and then worry about the path later. Link to comment Share on other sites More sharing options...
Jonathon Posted September 3, 2011 Share Posted September 3, 2011 You can reference outside the htdocs folder, I had a play with it a few weeks back and treated the xampp folder as my outside root folder as if it were live and it was ok. Link to comment Share on other sites More sharing options...
HartleySan Posted September 3, 2011 Share Posted September 3, 2011 Good to know. Thanks. Again, Dark Prince, without specifics, I'm really having trouble understanding what your problem is, but it seems like you're just plain not loading images properly. Link to comment Share on other sites More sharing options...
Recommended Posts