logo
down
shadow

sorl-thumbnail and file renaming


sorl-thumbnail and file renaming

By : user3861586
Date : November 20 2020, 07:00 PM
I hope this helps you . First part:
Just pass it in like this: sizes=( (56,34), (195,123), )
code :


Share : facebook icon twitter icon
Django - sorl-thumbnail - accessing thumbnail image from view functions

Django - sorl-thumbnail - accessing thumbnail image from view functions


By : Ajit Panigrahi
Date : March 29 2020, 07:55 AM
it helps some times Tried using thumbnails_for_file() and all_thumbnails() inside sorl-thumbnail 3.2.5 utils.py, but was unsuccessful. Seemed like those functions were returning thumbnails that were parsed directly from django templates. It just didn't return all thumbnail files.
Ended up just parsing out the file path by
code :
Entry.objects.all()[0].image.thumbnail.relative_url
Specifying file name and destination in get_thumbnail function of sorl thumbnail

Specifying file name and destination in get_thumbnail function of sorl thumbnail


By : Mihailo Tomić
Date : March 29 2020, 07:55 AM
it fixes the issue Short answer: you can't. The path and filename are generated by sorl and directly relate to how the thumbnail paths and their files are cached, and stored.
If you look at the actual method in sorl that gets or creates the thumbnail:
sorl-thumbnail: encoder error -2 when writing image file

sorl-thumbnail: encoder error -2 when writing image file


By : blackwingcat2000
Date : March 29 2020, 07:55 AM
Hope this helps I ended up patching the file pil_engine.py in /lib/python2.7/site-packages/sorl/thumbnail/engines:
code :
--- pil_engine.py   2013-09-09 03:58:27.000000000 +0000
+++ pil_engine_new.py   2013-11-05 21:19:15.053034383 +0000
@@ -79,6 +79,7 @@
             image.save(buf, **params)
         except IOError:
             params.pop('optimize')
+            ImageFile.MAXBLOCK = image.size[0] * image.size[1]
             image.save(buf, **params)
         raw_data = buf.getvalue()
         buf.close()
sorl-thumbnail: Creating a thumbnail inside a for loop in a template

sorl-thumbnail: Creating a thumbnail inside a for loop in a template


By : user3799622
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , I am trying to create a thumbnail with the size of 100x100 px from an image. I am using a for loop, and the for loops works and the image is rendered but for some reason when I am trying to create a thumbnail it doesn't work. , It looks like your plural are in the wrong spot:
code :
{% for post_images in post.sellpostimage_set.all %}
{% for post_image in post.sellpostimage_set.all %}
post_image = SellPostImage.objects.filter(post=poster_posts)
context_dict['post_image'] = post_image
post_images = SellPostImage.objects.filter(post=poster_posts)
context_dict['post_images'] = post_images
post_image = SellPostImage.objects.get(post=poster_posts)
context_dict['post_image'] = post_image
{% for post_images in post.sellpostimage_set.all %}
<img class="thumbnail" src="{{ post_images.pictures.url }}" />
<img class="thumbnail" src="{{ post_image.picture.url }}" />
Renaming sorl-thumbnail images in templates

Renaming sorl-thumbnail images in templates


By : Hakingpawns
Date : March 29 2020, 07:55 AM
this one helps. Yes it is possible by creating your own backend based on the default one and overload the _get_thumbnail_filename method.
For example, something like this
Related Posts Related Posts :
  • Removing non-breaking spaces from strings using Python
  • Is there a way to backup everything in an app-engine blobstore?
  • Process a set of files from a source directory to a destination directory in Python
  • How to know if optparse option was passed in the command line or as a default
  • Rewriting a for loop in pure NumPy to decrease execution time
  • Comparing a time delta in python
  • Find next lower item in a sorted list
  • MySQLdb not INSERTING, _mysql does fine
  • Scipy Negative Distance? What?
  • What are the common patterns in web programming?
  • Percent signs in windows path
  • How to add a random number to a subsection of a numpy array?
  • How to generate all the values of an iterable besides the last few?
  • Searching by both class and range in XPath
  • Python code execution in Perl interpreter
  • Best Way to Include Variable in Python3
  • Serialize the @property methods in a Python class
  • What is the most platform- and Python-version-independent way to make a fast loop for use in Python?
  • Good way to edit the previous defined class in ipython
  • Bounced email on Google App Engine
  • Search jpeg files using python
  • Dynamically create class attributes
  • python unichr problem
  • Python beginner, strange output problem
  • Python: Finding a value in 1 list and finding that corresponding index in another list
  • can't install mysqlclient on mac os x mojave
  • Error indicates flattened dimensions when loading pre-trained network
  • how to replace underlines with words?
  • Adding through iteration
  • Use OpenCV on deployed Flask app (Heroku)
  • How to skip interstitial in a django view if a user hits the back button?
  • Any Naive Bayesian Classifier in python?
  • Python 2.5.2: remove what found between two lines that contain two concrete strings
  • Python 2.5.2 script that add "The function starts here" to all the functions of the files of a directory
  • HttpResponseRedirect question
  • Python socket error on UDP data receive. (10054)
  • Encoding issues with cloud ml
  • numpy.where - Weird behaviour: new elements spawning from nowhere?
  • I can't move my player in pygame, can you figure why?
  • Weird error I receive from Tkinter in Python
  • Using a Zapier Custom Request Webhook with JSON Web Tokens
  • Keras: Use categorical_crossentropy without one-hot encoded array of targets
  • Does python's httplib.HTTPConnection block?
  • Do alternate python implementation version numbers imply that they provide the same syntax?
  • Searching for specific HTML string using Python
  • python sax error "junk after document element"
  • MySql: How to know if an entry is compressed or not
  • Return a list of imported Python modules used in a script?
  • Returning a list in this recursive coi function in python
  • Python2.6 Decimal to Octal
  • Appengine Apps Vs Google bot web crawler
  • Changing models in django results in broken database?
  • Global variable functions
  • Using lambda inside a function
  • How to open a file, replace some strings, and save updates to the same file?
  • How to move the beginning of an input to the and?
  • If else fill variable if empty list
  • Pandas: Find and print all floats in column
  • sqlite3.OperationalError: database is locked - non-threaded application
  • How to implement mib module in net-snmp with python?
  • shadow
    Privacy Policy - Terms - Contact Us © 35dp-dentalpractice.co.uk