Hi everyone,
Today I've had some serious issues with trying to load images into my views.py.
First of all Im on Django 17 and Python 3.4, apparently this means no urllib, urllib2, StringIO, cStringIO, BytesIO.
So I have requests and BeautifulSoup to work with. And also Pillow.
There is an image here: http://uploads.im/lyd0w.png
I'm trying to return the size:
rq = requests.get('http://uploads.im/lyd0w.png')
image = Image.open(rq)
#soup = BeautifulSoup(rq.content, 'html.parser')
#imgs = soup.select('img') (Didn't work)
sz = image.size
return render_to_response('crophop/imgur.html',{'link':sz})
Nothing has been working. I've seen loads and loads of examples with urllib and StringIO which is what makes it so frustrating.
I've spent hours today trying to make this work. Does anyone have an idea how I can either make the code work or get StringIO onto my system?
Thanks,
Fred