0

I'm uploading an image via my iOS app and setting a created node's image field to the image through Drupal Services. Everything appears to be correct (see uploaded photo from 'Recent Logs'). However when I navigate to the node, the image field is empty? Any idea as to why this might be? All help is appreciated, thanks.

enter image description here

0

I'm late to the party, but I think you might be encoding the image wrongly. You need base64 encoding. Here is how encoding works on my end with Python 3.5.2:

import os, base64
size = os.path.getsize(filename)
filesize = os.stat(filename).st_size
filemime = mimetypes.guess_type(filename)
fd = open(filename, 'rb')
image_data = base64.b64encode(fd.read())
fd.close()
  • Why do you say that? The file element in the picture seems to be base64, and attempting to decode the beginning of the visible fragment reveals a JFIF header which looks correct to my (untrained) eye. – tripleee Oct 24 '16 at 6:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.