EGL Development User Group

EGL Development User Group

EGL Development User Group

The EGL Development User Group is dedicated to sharing news, knowledge, and insights regarding the EGL language and Business Developer product. Consisting of IBMers, HCL, and users, this community collaborates to advance the EGL ecosystem.

 View Only
  • 1.  Does my image exist

    Posted Tue December 08, 2015 11:04 AM

    In my EGL project 9.1.1...I need to check if a image exists in the IFS. If it does, show the image. If it does not exist, show 'No Image Available'. Right now, all it does is show a blank box if there is no image. Is there a way in EGL that I can check that image before I set the image URL.

    On the browser side when the Image is not there I get:

    GET https://mydomain.com/pics/thumbs/tn_C9979.JPG 404 (Not Found)

    Is there a function or something in EGL that can check for a 404 response from the server?

    Ritchie

     

    Gadberry


  • 2.  Re: Does my image exist

    Posted Tue December 08, 2015 08:56 PM

    Hi Ritchie,

    According to your requirement, I don't think you need to check the image url.  Just add a text property for your image widget.  The text will only show when the src is invalid.

    image Image{ src="my.img", text = "No Image Available"};

    HuangJiYong


  • 3.  Re: Does my image exist

    Posted Wed December 09, 2015 02:19 PM

    Huang thanks for your response,

    For the functionality to work right, I will need to check to see if the image is there. When you first come into the app no images are available until they select a certain style. Sometimes the style they select will not have a image with it. I want to have another image that will have 'No image available' if it is not there. If I add the text to the image widget it will show up when they first come into the app. That is misleading to the user. 

    I have tried a HttpRequest, but I get error: No 'Access-Control-Allow-Origin' header is present on the requested resource.

    Ran into this before and really don't want to go down that path again. This error is caused when your on the same server but try to access something on a different port. Browsers do not like you doing that.

    That's why I was asking if there was some EGL widget or something I didn't know about that could handle this.

    Ritchie

     

     

    Gadberry