Created
February 11, 2013 14:07
-
-
Save sebietter/4754591 to your computer and use it in GitHub Desktop.
With this script for Pythonista you can easily upload a picture from iOS to your own webserver.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import webbrowser | |
import clipboard | |
import Image, ImageFile | |
import datetime | |
import ftplib | |
import urllib | |
from io import BytesIO | |
today = datetime.datetime.now() | |
image = clipboard.get_image() | |
fileName = 'picture_iOS' | |
fileName = fileName + '_' + today.strftime("%Y-%m-%d-%H%M%S") + '.png' | |
urlBase = 'YOUR BASE URL' | |
encodedFileName = urllib.quote(fileName) | |
print fileName | |
buffer = BytesIO() | |
image.save(buffer, 'PNG') | |
buffer.seek(0) | |
ftp = ftplib.FTP('YOUR FTP SERVER', 'YOUR LOGIN', 'YOUR PASSWORD') | |
ftp.storbinary('STOR '+fileName, buffer) | |
ftp.quit() | |
clipboard.set(urlBase + encodedFileName) | |
print 'Success! The link to your uploaded picture is now in your clipboard.' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment