Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Adding images to repeat region

Explorer ,
Jan 02, 2012 Jan 02, 2012

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

TOPICS
Server side applications
1.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Jan 02, 2012 Jan 02, 2012

>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

...
Translate
LEGEND ,
Jan 02, 2012 Jan 02, 2012

>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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Jan 03, 2012 Jan 03, 2012

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'>";

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 03, 2012 Jan 03, 2012
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines