Web Connection
Inconsistent image rotation behavior
Gravatar is a globally recognized avatar based on your email address. Inconsistent image rotation behavior
  Richard Kaye
  All
  Apr 13, 2021 @ 10:35am

Hi Rick (and lurkers),

This is my day for firing in questions. 😃

In our application we have the ability to upload images associated with a piece of inventory. After each image is uploaded, it is then rendered in the front end like this:

I can then click the Rotate button and the image should be rotated clockwise by 90% for each click. We're using the RotateImage function from wwApi to do this. This fires off a save event in the application code which does a postback. We are adding a random parameter to the URL to theoretically force the browser to not go to cache. What we are seeing in the FE is that sometimes we see the proper rotation and sometimes we don't. If the user refreshes the page, which resubmits the postback, the image goes through 2 rotations. Alternatively, we have an undo button in the UI which will just reload the page without the postback, and when we do that we see the single rotation as expected.

So the $64,000 question is, what is the recommended way to reliably see the single rotation after each click of the Rotate link?

TIA

Gravatar is a globally recognized avatar based on your email address. re: Inconsistent image rotation behavior
  Rick Strahl
  Richard Kaye
  Apr 13, 2021 @ 11:04am

If you use POST you should always see the change.

If you're using GET you have to worry about caching and the best way around that is to add a random value to the URL so the URL is different and doesn't cache.

Like:

https://mysite.com/RotateImage.tst?u=423412312

You can generate a reasonably unique value (by ms) from new Date().getTime() if you're generating the URL on the client or Sys(2015) in FoxPro

© 1996-2024