This is a migrated thread and some comments may be shown as answers.

Previous image is set on page load

5 Answers 114 Views
ImageEditor
This is a migrated thread and some comments may be shown as answers.
E.P.
Top achievements
Rank 1
E.P. asked on 27 Feb 2020, 09:27 AM

Hi

I have put the image editor in a page that is overlaid on another page.

In the page with the image editor, I set an image, edited it, save it, and then close the page and info passed back to the page it is overlaid upon. This is all fine.

When I re-open the the page on top again to edit a new image, it is not correctly showing the new image passed in and is showing the previous image from "before the editing" of that image. When I reload the page it shows the new image correctly but I can't auto reload the page each time because then there will be an infinite loop of reloading the page.

I think this might be due to a cache. Is there a way to flush the cache and/or reload the image?

Thanks.

5 Answers, 1 is accepted

Sort by
0
Vessy
Telerik team
answered on 03 Mar 2020, 08:54 AM

Hi Eli,

Can you elaborate a bit on the way you are loading the new image into the ImageEditor? Are you loading it directly through the ImageUrl property or you are using the ImageLoading event handler? Are you using AJAX updates when loading the image or you are doing it on a full PostBack?

It will be really helpful if you send me a sample project where I can examine the exact setup leading to the problem and debug further what is causing it. You can see how to prepare such easily here: https://www.telerik.com/blogs/isolating-a-problem-in-a-sample-project

Regards,
Vessy
Progress Telerik

Get quickly onboarded and successful with UI for ASP.NET AJAX with the Virtual Classroom technical trainings, available to all active customers. Learn More.
0
E.P.
Top achievements
Rank 1
answered on 03 Mar 2020, 09:11 AM

Hi Vessy,

 

I'm loading it in the code behind.

On the client side, I edit the image, save it, and close it.

The image is correctly saved on the server.

But when I reopen the modal page on top that has the image editor, and the code behind loads the same image but it has been saved, it should be loading the image that has been saved, but is showing the image from before it was edited, so there is some sort of cache somewhere associated with the ImageEditor.

I'm unable to send you the project since it's integrated into a business application.

Regards

0
Vessy
Telerik team
answered on 03 Mar 2020, 03:26 PM

Hi Eli,

You do not have to send me the whole application, I just need to see the logic related to the ImageEditor (its setup, the ajax updates, the logic reloading the images). Would it be possible to isolate this data so I can examine it at my end?

Regards,
Vessy
Progress Telerik

Get quickly onboarded and successful with UI for ASP.NET AJAX with the Virtual Classroom technical trainings, available to all active customers. Learn More.
0
E.P.
Top achievements
Rank 1
answered on 04 Mar 2020, 04:32 AM

Hi Vessy,

Here is a link to the sample project I got before I purchased it, I can explain how to replicate the problem using that.

<dropbox link to runnable project, removed by Admin>

1. Run it (F5).

2. Copy the url to clipboard (which for me is coming up as http://localhost:49573/Default.aspx)

3. Enter text into the image

4. Click the save button, select "save image on server" and click "ok"

5. Go to another tab in your browser (I am using firefox), and paste the url and hit enter.

 

The image comes up showing before the edit on the previous tab without the added text in there.

You can continue to enter the url into another tab and another and another, and it continues each time to show the original image before it was edited.

Now, when you check the image in the project (ie on the server), it has been edited correctly and has the text showing from your update in the first tab, so it has definitely been saved.

You can go and open a new tab again and paste in the url and it will continue to show the image before it was edited. Something is cached somewhere and not actually loading the real image.

When you go back to the second tab (or any of the others) and refresh it, it _then_ shows the edited image correctly, but only after refreshing it.

There is some cache somewhere that is not being cleared / updated.

Regards

0
Peter Milchev
Telerik team
answered on 15 Jul 2020, 01:39 PM

Hello Eli,

The caching issue is indeed entirely browser-related and the same thing is observed with loading a simple img tag with this src and manually change the file on the server.

Nevertheless, you can use the following code that would add custom query parameters to the URL of the image, so that it always loads the image from the server on the initial load of the page:

protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
        RadImageEditor1.ImageUrl = RadImageEditor1.ImageUrl + "?cachebuster=" + Guid.NewGuid().ToString();
    }
}

Regards,
Peter Milchev
Progress Telerik

Tags
ImageEditor
Asked by
E.P.
Top achievements
Rank 1
Answers by
Vessy
Telerik team
E.P.
Top achievements
Rank 1
Peter Milchev
Telerik team
Share this question
or