Can you show us what the code rendered from the browser for one record looks like? That way we can see how the php code is being interpreted.
No, show us the code, not the image.
Sorry, here is the code:
<td width="123"><h6>2013-02-24 16:23:37</h6></td>
<td width="123"><h6>2013-02-24 16:27:51</h6></td>
On the current computer I am on, it displays "No image to display". On my home computer, it shows the icon (above).
You're using document relative referencing for the images. Is the image folder located at the same level as the folder that this page is on? Or is the page located at the site root?
I have pasted the structure below. As you can see, there is one HTML folder. All other folders reside at the next level, including my images folder.
Sending this to supplement the post previously sent.
The last one didn't seem to work...maybe if I attach it as a word file you
can see it to comment on.
As a test try including the absolute url to the image like below:
If locally testing:
<img src="localhost/websiteFoldername/imageFolderName/<?php echo $row_Recordset1['Image']; ?>
<img src="http://www.websiteName.com/imageFolderName/<?php echo $row_Recordset1['Image']; ?>
If you don't see an image when using the full url then there's something incorrect in your database (check the image name has a .jpg extention).
If you do see an image as I expect you should then you have to get the link path to the image correct if you don't want to use the absolute url. It might be ../
>I have pasted the structure below. As you can see, there is one HTML folder.
>All other folders reside at the next level, including my images folder.
None of your attachment have worked. Is the php document you are working with located in the site root folder, or in a subfolder?
Yes, the php document is located in the site root folder.
Additionally, the images folder is located at that same level.
Incidentally, I used the remote testing absolute URL (osgood suggested above), but received the same result. When inspecing the code, it looks like the correct file is inserted into the code from the mySQL database, just no picture.
>Yes, the php document is located in the site root folder.
>Additionally, the images folder is located at that same level.
<img src="./images/katie's camera fall 2011 036.JPG"
Your path is not correct. If the doc is at root level, that path is telling the browser to move up one level - which is not valid- before moving down to the image folder. You're better off using root relative paths for this. Just remove the preceeding dot in the path. If you want to continue using doc relative paths, remove the preceeding dot and slash. You should probably become more familiar with server path syntax. I would also suggest not have filenames with spaces in them.
When inspecing the code, it looks like the correct file is inserted into the code from the mySQL database, just no picture.
So when you view the code you see the absolute path followed by the name of the image?
You say you are testing remotely. Type the absolute path to this image directly in the browser url bar, does it show up?
No it does not show up
1 person found this helpful
If it does not show up then its not in the location the link thinks its in.
As a test make a copy of the image and place it directly in your site folder then do another absolute link test:
If it doesn't show up then there is something wrong with the image (check the color space is saved as RGB and not CMYK)
If it does show up it means that the path to the image is incorrect in your original test file.
So locally I have the layout similar to the following:
-SITE ROOT FOLDER
in my dynamic table, I have
<td><img src="<?php echo $row_Recordset1['Image']; ?>" alt="If there's an image, it would be here" name="" width="120" height="120" /></td>
which will take the specified image from Recordset1['Image'] and place it at the end of the designated folder, which locally would be SITE/IMAGES/UPLOADS. So how does this syntax translate to the server?
When I examine the rendering, the file from the database (the image) is correctly identified, and at the end of the string. So I assume the structure is pointing to a folder that doesn't exist, or as you said, the syntax is incorrect.
The Dreamweaver tutorials, and the missing manual do not describe (that I could find) requiring the file path in front of the echo command. For the most part they indicate that an image placeholder could be set in the dynamic table, and the "Image" recordset bound to that image.
1 person found this helpful
Yes, your image source must point to exactly where the image resides. Your browser code showed this:
which means you have not embedded the full path in your database - there is no UPLOAD folder in your path. You also need to fix the document relative path problem I mentioned earlier. Finally, you mention that your images are in a folder named UPLOADS under the IMAGES folder. But your recordset shows a lowercase 'images' folder. *nix servers are case sensitive so you need to be sure the cases match exactly. So it looks like you have several problems you need to address.
Osgood, I noticed that when a file is uploaded to the database, the file is truncated, for example 120_035.jpg
The file in the folder on the FTP file manager, however, is 120_0351361934386.jpg
So, I typed in as you mentioned, first using the truncated file, with no result.
Then I did the same with the full file name, with the image shown.
So maybe this is a cause for the situation...but how do I match the file that is uploaded to the file manager, and the name of the file in the database?
Two things may be happening here;
1) The column type (Length Value) in your database may not be set to receive as many characters as the image name has. What have you got set?
2) How are you uploading the images to the uploads folder? If through a form and upload script the script many be attaching a series of randon numbers to stop images already uploaded with potentially the same name being overwritten.
I'd first have a look at what you have set in the Length Value column of your database.
I have it listed as Varchar, 500 characters in length in MySQL.
I purchased a Linecraft image upload package so I did not write any of the script myself, but I assume you're right (to avoid duplicates).
So are you saying you are manually inserting the image information into the database field as 120_035.jpg
then using the upload facility to select 120_035.jpg and that get uploaded as: 120_0351361934386.jpg
or are you saying the automated upload facility inserts the image name into the database BUT truncates it to 120_035.jpg
The latter is correct. I pick a file to upload, click submit, and the image goes to the file with the full name, and the truncated name goes to the datbase.
Incidentally, the original name of the file prior to uploading from my machine is 120_035.jpg, not 120_0351361934386.jpg, so that I assume it is elongated to prevent duplication as you said.
Well it appears as though the original uploaded image from your computer 120_035.jpg information is being inserted into the database before the additional numbers are getting added. When the additional numbers have been added the image then gets moved to the upload images folder.
That creates a problem because the recordset only sees 120_035.jpg and not the longer number, so the image can't be found as it no longer exists as 120_035.jpg
You have to try and find a way of not letting the information get uploaded to the database before the extra number have been added.
Was moving the image to the database part of the upload package you bought. If so you will probably have to go back to them and ask why this is happening. Maybe there's a way to stop it adding the random set of numbers to the original image name, which would also solve the issue but then there is the potential for an image to be overwritten. All these upload facilities should come with a error warning anyway if there is a duplicated name in the upload folder.