Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Image load via from a directory via calc

Featured Replies

For each record there could be 1-20 images that will be load from a directory.

So if I loaded 3 images into record one's directory (01.jpg, 02.jpg, 03.jpg) I would then set the records image count to 3, and then CDML would generate a list (image1, image2, image3) and each Item would have a url that would load the image.

Can I calculate the string and then use it in the generation of the page?

I know I could do it with a relationship but I am trying to create a single file web solution.

David

Limit of 20 images you say... Calculation could be:

If (imagecount <= 1, "image1.jpg", "")

If (imagecount <= 2, "image2.jpg", "")

If (imagecount <= 3, "image3.jpg", "")

If (imagecount <= 4, "image4.jpg", "")

...

If (imagecount <= 20, "image20.jpg", "")

That's your basic calculation, but it's not really going to be much good if you want to make the images hot-linked because you'll than have to add a whole heap of html code to the calculation:

If (imagecount <= 4, "<a href=image4.jpg>image4</a>", "")

but then it could start getting complicated if the urls change for each image or whatever. I reckon the related solution is going to be a lot easier to code in CDML.

We've used 'Repeating' fields for this type of thing. Works well.

All the best.

Garry

Hi,

if you have a separate directory for each record, can I suggest a no-brain workaround.

create your directory with a full set of dummy images already in there, but use a 1x1 pixel gif or jpg.

As you load real images into the directory, the blanks get overwritten because they have the same name. You can deliver all of the images all of the time without showing a broken link and with minimal effect on your layout.

In my image calculation fields, I tend to have the calculation default to delivering 'zero.gif' whenever there's no real image to display.

regards, jeff

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.