Pythonista Upload Photos from Library
-
Hey Guys,
i Have a new idea and a new Question xD
is it Possible to select multiple Photos from my complete Photo-Library and upload it to my server via ftps ?
i found this on the documentation:
import photos assets = photos.pick_asset(title='Pick some assets', multi=True) print(assets)
here i can select some vids and pics.
but how i get the path of the files to use it in ftp ?
and nice to have were to rename each fileis this possible ?
-
@DavinE try so
iv = ui.ImageView() iv.present('fullscreen') assets = photos.pick_asset(title='Pick some assets', multi=True) for asset in assets: pil = asset.get_image(original=False) iv.image = asset.get_ui_image() #pil.save(os.path.join(os.path.dirname(sys.argv[0]), filename), quality=95) temp = io.BytesIO() pil.save(temp, format='JPEG', quality=95) temp.seek(0) filename = '%s%s' % (console.input_alert('Rename File', 'Message: rename File', hide_cancel_button=False), '.PNG') ftp.storbinary('STOR Films/Divers/'+filename , temp) iv.close()
-
@cvp said:
@DavinE try so
iv = ui.ImageView() iv.present('fullscreen') assets = photos.pick_asset(title='Pick some assets', multi=True) for asset in assets: pil = asset.get_image(original=False) iv.image = asset.get_ui_image() #pil.save(os.path.join(os.path.dirname(sys.argv[0]), filename), quality=95) temp = io.BytesIO() pil.save(temp, format='JPEG', quality=95) temp.seek(0) filename = '%s%s' % (console.input_alert('Rename File', 'Message: rename File', hide_cancel_button=False), '.PNG') ftp.storbinary('STOR Films/Divers/'+filename , temp) iv.close()
lol.. This works ^^
i used it like this:assets = photos.pick_asset(title='Pick some assets', multi=True) for asset in assets: pil = asset.get_image(original=False) iv = ui.ImageView() iv.image = asset.get_ui_image() iv.present('fullscreen') #pil.save(os.path.join(os.path.dirname(sys.argv[0]), filename), quality=95) temp = io.BytesIO() pil.save(temp, format='JPEG', quality=95) temp.seek(0) filename = '%s%s' % (console.input_alert('Rename File', 'Message: rename File', hide_cancel_button=False), '.PNG') ftp.storbinary('STOR Films/Divers/'+filename , temp) iv.close()
but thus i get the error ^^
Thanks again @cvp
-
@DavinE said:
lol.. This works
Only one view, used for all photos, one after one.
Your (my previous) script created a new view for each photo and we present the next one before the previous one is fully closed, known problem.
-
@DavinE If you want a file picker, you can use this one and passing your "On my iDevice" folder, like
file = file_picker_dialog('On your iDevice', root_dir='/private/var/mobile/Containers/Shared/AppGroup/EF3F9065-AD98-4DE3-B5DB-21170E88B77F/File Provider Storage')
-
@cvp said:
@DavinE said:
lol.. This works
Only one view, used for all photos, one after one.
Your (my previous) script created a new view for each photo and we present the next one before the previous one is fully closed, known problem.
ah oaky..
now i know it xD
-
@cvp said:
@DavinE If you want a file picker, you can use this one and passing your "On my iDevice" folder, like
file = file_picker_dialog('On your iDevice', root_dir='/private/var/mobile/Containers/Shared/AppGroup/EF3F9065-AD98-4DE3-B5DB-21170E88B77F/File Provider Storage')
i take a look on this ;) ty
-
@cvp,
I have a Problem....
my Code:assets = photos.pick_asset(title='Bitte wähle deine Bilder aus', multi=True) iv = ui.ImageView() iv.present('fullscreen') for asset in assets: pil = asset.get_image(original=False) iv.image = asset.get_ui_image() temp = io.BytesIO() pil.save(temp, format='JPEG', quality=95) temp.seek(0) filename = '%s%s' % (console.input_alert('Bennung des Bildes', 'Gib deinem Bild einen Namen', hide_cancel_button=False), '.JPEG') self.connection_FTP.storbinary('STOR '+f'{self.subDirCustomer_Bilder}/{filename}', temp, blocksize=32768) iv.close()
doesn't work anymore... but i don't get an error or something...
but i don't know whydid you maybe see anything ?
I tried this code and it works but now... nothing....
-
my mistake...
my Drive Client did not work :(
-
@DavinE ok, thus, good luck