0

Morning,

Bit stumped on this one.

Working in Django with Images and am trying to create a series of image sizes for a gallery. I need the value first as a tuple so that Image.thumbnail works and then as a string so I can save the file with the new size appended to it (wordpress style)

Why does the following code return a sequence item 0: expected string, int found error?

IMAGE_SIZES = {
    'THUMBNAIL':(160, 160),
    'MEDIUM':(600,600),
    'LARGE':(1000,1000),
}
for key,value in IMAGE_SIZES.items():
    temp = key + "x".join(value)
    print (temp)

It worked OK as a singular value but placing the tuple into a dictionary and iterating over it has broken it. I looked at a couple of solutions on Stack but most seem to just refer to key, value. One suggested I should join the items in the tuple but this does not seem to work with.

Byte Insight
  • 745
  • 1
  • 6
  • 17

0 Answers0