Web Connection
How does a website get images for the items sold on website
Gravatar is a globally recognized avatar based on your email address. How does a website get images for the items sold on website
  VFPJCOOK
  All
  Jul 11, 2024 @ 10:14am

I have searched and searched to no avail. I have a website written in react. I have an API written using WWWC that serves up the foxpro data to the website. The API provides a path to where the menu item images are stored. The API provides the menu of items sold on the website. For each item sold on the website there is an image. The image files are named <item's guid>.jpg The images are stored on the same cloud server as is hosting the website (if that matters). Can the website somehow "see" the images on the server or does my API need an endpoint that serves up the image?

If the website has to call an endpoint in my API, I assume it would work like this. After the API provides the menu, the website would loop thru the menu items and call the API endpoint to GetTheImage() passing the item's guid and the API would respond with the appropriate image file (jpg). If there are 1000 items sold that would be 1000 calls to the GetTheImage endpoint. I am concerned that could take a while.

Can someone tell me there is a simpler way or is that the way it has to be?

Thanks, John

Gravatar is a globally recognized avatar based on your email address. re: How does a website get images for the items sold on website
  Rick Strahl
  VFPJCOOK
  Jul 11, 2024 @ 01:37pm

As long as you can access the images as a URL you can reference them in any <img src="" /> tag.

Typically what you do is provide your client app some sort of base Url (if it's not on your local site) like https://images.mysite.com/product-images/ and then you build a URL dynamically with something like this:

<img src="{{ model.config.baseImageUrl + model.item.sku  + '.jpg' }}" />

+++ Rick ---

© 1996-2024