django - Modify image extension to use later -


I am using the PIL in the document to crop the image and save the copy of it:

  Image.save (os.path.abspath (os.path.join (os.path.dirname (__ file __), '..')) + kid.image_url + "thumbnail", "JPEG")   

The image thumbnails are temporarily saved and can be accessed at:

  kid.image_url + "Thumbnail"   

I have a problem save it in the original format, do not have a thumbnail and access it later Be enabled. Is there a better solution, such as "_ thumbnail" after the image and it should be able to access it by the child .image_url + "_ thumbnail"

Here you can change "example.jpg" to "example.thumb.jpg": < / P>

  Import OS filename, extn = os.path.splitext (kid.image_url) thumb_filename = filename + ". Thumb" + extn    

Comments

Popular posts from this blog

python - how we can use ajax() in views.py in django? -

matlab - Using loops to get multiple values into a cell -

python - Sequence Pattern recognition with Pybrain -