Title: Replace image doesn&#8217;t work
Last modified: December 1, 2020

---

# Replace image doesn’t work

 *  Resolved [formicacraftuje](https://wordpress.org/support/users/formicacraftuje/)
 * (@formicacraftuje)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/replace-image-doesnt-work/)
 * I have seen couple of topics with exact same issue, but no solution.
 * “Replace image” doesn’t replace the “preview thumbnail”, only the image that 
   you see after clicking.
 * Cache is cleared, deep refreshing, nothing helps.
    **The source for the thumbnail
   is not replaced in the database of the gallery! **
 * Can you do something about it? Removing image and adding another is not the solution,
   because when you want to replace an image inside the gallery it messes all the
   tile order 🙂

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [visi19](https://wordpress.org/support/users/visi19/)
 * (@visi19)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/replace-image-doesnt-work/#post-13734665)
 * Hello [@formicacraftuje](https://wordpress.org/support/users/formicacraftuje/)
 * Thanks you for reaching us !
 * [https://github.com/WPChill/gallery-photoblocks/issues/20](https://github.com/WPChill/gallery-photoblocks/issues/20)-
   > Thanks for reporting this bug, we managed to reproduce your problem and posted
   it on github.
    Thank you for understanding !
 * Please let me know if you have some more quesitons !
 * Have a nice day ! 🙂
 * Warmly,
    Marian
 *  Thread Starter [formicacraftuje](https://wordpress.org/support/users/formicacraftuje/)
 * (@formicacraftuje)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/replace-image-doesnt-work/#post-13739268)
 * Hi,
    I looked at the plugin code, and added couple of lines in function replaceImage
   in admin/js/photoblocks.grid.js. It helped.
 *     ```
       selection.map(function(attachment) {
                 attachment = attachment.toJSON();
                 $block.data("conf").image.url = attachment.url;
       /* added lines */
                 $block.data("conf").image.id = attachment.id;
       	  if (attachment.sizes && attachment.sizes.thumbnail)
                     $block.data("conf").thumbnail = attachment.sizes.thumbnail.url;
                 if (attachment.sizes && attachment.sizes.large)
                     $block.data("conf").large = attachment.sizes.large.url;
       /* end of added lines */
                 $block.css({
                   backgroundImage: "url('" + attachment.url + "')"
                 })
               });
       ```
   
    -  This reply was modified 5 years, 5 months ago by [formicacraftuje](https://wordpress.org/support/users/formicacraftuje/).
 *  [visi19](https://wordpress.org/support/users/visi19/)
 * (@visi19)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/replace-image-doesnt-work/#post-13739470)
 * Hello [@formicacraftuje](https://wordpress.org/support/users/formicacraftuje/)
 * Thank you very much for your understanding!
    A solution will appear in connection
   with this problem, we do not know the exact date yet, but you have the topic 
   here and you will be able to check the moment when it will be “solved”. Thank
   you again!
 * Warmly,
    Marian

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Replace image doesn’t work’ is closed to new replies.

 * ![](https://ps.w.org/photoblocks-grid-gallery/assets/icon.svg?rev=3184340)
 * [Gallery PhotoBlocks](https://wordpress.org/plugins/photoblocks-grid-gallery/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/photoblocks-grid-gallery/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/photoblocks-grid-gallery/)
 * [Active Topics](https://wordpress.org/support/plugin/photoblocks-grid-gallery/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/photoblocks-grid-gallery/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/photoblocks-grid-gallery/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [visi19](https://wordpress.org/support/users/visi19/)
 * Last activity: [5 years, 5 months ago](https://wordpress.org/support/topic/replace-image-doesnt-work/#post-13739470)
 * Status: resolved