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

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -