Fail to update default product image in thumbnails cache

Issue #1465 new
Former user created an issue

In a template like 'product/product.html' is used thumbnail tag to get an image from cache to render. {% load thumbnail %} ... {% thumbnail pic.picture "200x250" as image %}

In case product's image is missing, thumbnail returns the default image - 'images/productimage-picture-default.jpg' . This image is set by fixture, 'product/fixtures/initial_data.yaml' to be concrete. Path of the image and Caption are stores in store's database in 'product_productimage' table with id=1.

However once the original default image is put in cache, any following attempts to replace it with another image fails. 1st attempt) - stop django's server - replace <store>/static/images/productimage-picture-default.jpg with another one - clear thumbnails cache with ./manage.py thumnal cleanup and ./manage.py thumnal clear - start server ./manage.py runserver - thumbnail tag still returns the original default image

2nd attempt) - stop server - modify caption in fixture for product in '<satchmo sources>/apps/product/fixtures/initial_data.yaml' - replace image '<satchmo sources>/images/productimage-picture-default.jpg' with the different one - run ./manage.py syncdb to fixtures take an effect - can check with db client caption in product_productimage table has been altered - clear thumbnails cache with ./manage.py thumnal cleanup and ./manage.py thumnal clear - start server ./manage.py runserver - even after all this thumbnail tag still returns the original default image

I've lost ideas here. It may be a bug in satchmo_utils.thumbnail package or am I missing something here ?

Comments (2)

  1. dunric

    -- sorry, I did missed formatting options. Bellow is the updated content of issue #1465 --

    In a template like 'product/product.html' is used thumbnail tag to get an image from cache to render.

    {% load thumbnail %}
    ...
    {% thumbnail pic.picture "200x250" as image %}
    

    In case product's image is missing, thumbnail returns the default image - 'images/productimage-picture-default.jpg' . This image is set by fixture, 'product/fixtures/initial_data.yaml' to be concrete. Path of the image and Caption are stored in store's database in 'product_productimage' table with id=1.

    However once the original default image is put in cache, any following attempts to replace it with another image will fail.

    1st attempt)

    1. stop django's server
    2. replace <store>/static/images/productimage-picture-default.jpg with other one
    3. clear thumbnails cache with ./manage.py thumbnail cleanup and ./manage.py thumbnail clear
    4. start server ./manage.py runserver
    5. thumbnail tag still returns the original default image

    2nd attempt)

    1. stop server
    2. modify caption in fixture for product in '<satchmo sources>/apps/product/fixtures/initial_data.yaml'
    3. replace image '<satchmo sources>/images/productimage-picture-default.jpg' with the different one
    4. run ./manage.py syncdb to fixtures take an effect
    5. can check with db client caption field in product_productimage table has been altered
    6. clear thumbnails cache with ./manage.py thumbnail cleanup and ./manage.py thumbnail clear
    7. start server ./manage.py runserver even after all this thumbnail tag still returns the original default image

    I've lost ideas here. It may be a bug in satchmo_utils.thumbnail package or am I missing something here ?

  2. dunric

    Hello,

    I did fiddled how to get rid of cached default product/category image and found one, unfortunately a bit hackish, solution:

    from django console:

    from sorl.thumbnail import delete
    delete('images/categoryimage-picture-default.jpg')
    delete('images/productimage-picture-default.jpg')
    

    It'll also delete image files from <store>/static/images so you have to copy the new ones there. Still curious why thumbnail cleanup or clear do ignore default images. Or if it is an intended behaviour there has to be an option to include them for deletion '--with-defaults' .

  3. Log in to comment