Search code examples
impresspages

Overwrite IpReflection


I want to change Avatar, but I want to use ipReflection() too.

when I upload first image it works but when I change it stays the same, I tried to unbind then bind again same image but it doesn't work.

ipUnbindFile($image, 'UserModuleLogo', ipUser()->userId(), 'file/repository/UserFiles/');
ipBindFile($image, 'UserModuleLogo', ipUser()->userId(), 'file/repository/UserFiles/');

Solution

  • Binding the file is inserting its data to a database. There could be two issues, why changes aren't visible instantly:

    1. Browser cache. You save a new file with the same file name and browser thinks nothing has changed.
    2. Reflection cache. If filename is the same and options are the same, ImpressPages pulls image from the reflections without touching a new file.

    To fix the first issue, always change filename or add random parameter and the end of the file, i.e. "image.jpg?1029231230". To fix the second issue, always delete all reflection before replacing the file.