Title: Display Array Image Cache Question Post by: Gary C. on May 21, 2015, 11:08:05 pm Hi
I have a display array with some text fields along with an image field. This is used to display a variable number of images relating to a product. Here is the code that loads the local array: Code: function b13_loadimages() The array is displayed as part of an unbuffered dialog. You can see an example in the attached screen shot. I seem to be having a problem with the images caching if one views one product after the next. The text element of the array is always correct but the image displayed seems to be a cached version of the first product viewed. I've read through the manual but cannot see anything relating to this. So, do images cache somehow? If so, how do I override this behavior? Thanks Gary Title: Re: Display Array Image Cache Question Post by: Reuben B. on May 22, 2015, 12:09:09 am Image cache was introduced with GDC 2.20, see here https://4js.com/online_documentation/fjs-gdc-manual-html/index.html#c_gdc_NewFeatures220_image_cache.html
I suspect it isn't the cause of your issue (as formfield IMAGE aren't cached by default), but you can try disabling the cache in the GDC console and/or via a presentation style first. Reuben Title: Re: Display Array Image Cache Question Post by: Sebastien F. on May 22, 2015, 09:13:00 am Your code looks ok... what FGL / GDC version are you using? Platform?
Can you provide a little and complete sample (with form file) to the support so we can try to reproduce here? Seb Title: Re: Display Array Image Cache Question Post by: Gary C. on June 04, 2015, 03:08:55 pm Hello
Apologies for the delay. I have been away for the past week or so. I have put together a sample which demonstrates the problem - albeit the images are loaded from files as opposed from the database. Gary Title: Re: Display Array Image Cache Question Post by: Gary C. on June 04, 2015, 09:12:52 pm Hi
I have discovered that specifically "freeing" the image prior to clearing and reloading the array resolves the problem. So, in the example I added: Code: for idx = 1 to tabimgA.getLength() Gary Title: Re: Display Array Image Cache Question Post by: Rene S. on June 09, 2015, 12:03:05 pm Hello,
I was curious why your workaround (freeing each image before clearing the array) is working. You're using LOCATE IN FILE. Each LOCATE IN FILE creates a temp file. Prior to version 2.51.02: temp file names will be reused. This has the side effect that a LOCATE IN FILE of a BYTE or TEXT variable already being located will get exactly the same name. This causes the cache problems: the file name does not change, GDC does not reload the image. Since version 2.51.02: temp file names will not be reused. Your example code works as expected, no workaround required. Bad news: BTW: your workaround fails, if only 1 image is in the list! Rene Title: Re: Display Array Image Cache Question Post by: Gary C. on June 10, 2015, 09:19:09 am Hi
Thanks for the explanation which makes perfect sense. Can you explain why the workaround fails? I've looked and tested but it seems to work irrespective of the array length. Perhaps I am missing something obvious? Gary Title: Re: Display Array Image Cache Question Post by: Rene S. on June 10, 2015, 02:41:01 pm It's not working with 1 image because the name of the temp file does not change.
Edit your example, fill the array with just 1 record, the image "image1.jpg" in the 1st case, the image "image2.jpg" in the 2nd case (yes, this is no more "sort ascending" and "sort descending", it's "show image1" and "show image2". Rene Code
|