Skip to content
This repository has been archived by the owner on Dec 28, 2017. It is now read-only.

athumb_regen_field command, created image is not appearing in frontend. #28

Open
renjithraj2005 opened this issue Oct 16, 2014 · 1 comment

Comments

@renjithraj2005
Copy link

When try to create thumbnail using command athumb_regen_field thumbnail getting created with different name so in front end it is not showing the updated thumbnail, showing old one. This issue is only when already generated thumbnail image is there in the disk.

This can be resolved by removing the initial image when we regenerate the thumbnails.

def create_and_store_thumb(self, image, thumb_name, thumb_options):
    """
    Given that 'image' is a PIL Image object, create a thumbnail for the
    given size tuple and store it via the storage backend.

    image: (Image) PIL Image object.
    size: (tuple) Tuple in form of (width, height). Image will be
        thumbnailed to this size.
    """
    size = thumb_options['size']
    upscale = thumb_options.get('upscale', True)
    crop = thumb_options.get('crop')
    if crop is True:
        # We'll just make an assumption here. Center cropping is the
        # typical default.
        crop = 'center'

    thumb_filename = self._calc_thumb_filename(thumb_name)
   # remove thumbnail file if already exist
    try:
        os.remove("%s/%s" % (settings.MEDIA_ROOT, thumb_filename))
    except OSError:
        # No thumbnail files initially
        pass
@gtaylor
Copy link
Owner

gtaylor commented Nov 14, 2014

I'm not sure I understand the problem, but athumb isn't really meant to be used with local storage. It's pretty S3-specific. I don't think we've ran into this with S3.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants