Copy link to clipboard
Copied
Hey guys, I've recently started using dreamweaver's PHP functions with MySQL and I've got my table data displaying in a repeat region. I've uploaded images to the database but if I drag 'image' from the recordset into the repeat region I just get lots of binary. I read that I should maybe use image URLs rather than pulling images from the database but I don't understand how to get the images in sequence. How would PHP know what order to display them in if they aren't in the recordset? I'm wondering if I've missed some feature in DW as I guess it's quite a common thing to want images in a repeat region. Any advice would be great. Thanks ![]()
>I read that I should maybe use image URLs
>rather than pulling images from the database
Correct. Storing binary files in the database leads to performance problems.
>but I don't understand how to get the images in sequence. How would
>PHP know what order to display them in if they aren't in the recordset?
The images are stored in the file system. The path to the images is stored in the database. The recordset contains the field that has the image path - so in the recordset loop you build the html
...Copy link to clipboard
Copied
>I read that I should maybe use image URLs
>rather than pulling images from the database
Correct. Storing binary files in the database leads to performance problems.
>but I don't understand how to get the images in sequence. How would
>PHP know what order to display them in if they aren't in the recordset?
The images are stored in the file system. The path to the images is stored in the database. The recordset contains the field that has the image path - so in the recordset loop you build the html that displays the image.
Copy link to clipboard
Copied
Small addition to what Bregent said:
Although it is possible to store images in the dabase, you can't just echo the contents the way you would textual data. We could tell you how it can be done, but, as Bregent pointe out, it is preferable (far far preferable) to store only the file name (or file name and path) in the database. Then your code looks something like this:
echo "<img src='$image_file' alt='$image_alt'>";
Copy link to clipboard
Copied
Thanks for the advice guys. I thought that using links was the best way but wasn't sure of the whole process. Will give this a try.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more