I am trying to write a script to upload an image at a public url to my Dropbox. I already have several other scripts uploading text files to Dropbox but he image isn't working. Any ides based on the code below?
import Image import photos import sys import webbrowser import console import urllib from urllib import urlopen from io import BytesIO from DropboxLogin import get_client dropbox_client = get_client() import clipboard import keychain import time import httplib url = 'http://313e5987718b346aaf83-f5e825270f29a84f7881423410384342.r78.cf1.rackcdn.com/Pythonista_-_screenshotscopy.PNG' img = urlopen(url).read() buffer = Image.open(BytesIO(img)) img.save(buffer, 'PNG') buffer.seek(0) response = dropbox_client.put_file('/Public/test.png', buffer)
I found a small piece of code posted on this forum to save an image from a url to the camera roll and it works very well. I added a small text manipulation of the URL and a notification below but I have one issue. The image saved to the camera roll has no EXIF metadata. Am I doing somthing wrong or is this not possible?
from urllib import urlopen
from io import BytesIO
dburl = clipboard.get()
url = dburl.replace('www', 'dl')
img = Image.open(BytesIO(urlopen(url).read()))
notification.schedule('Photo saved to camera roll', 1, 'default',)