Ejemplo n.º 1
0
 def _appex_action(self):
     if not appex.is_running_extension():
         self._err_msg(
             'This script was not started from the shared app extension (AppEx). This allows to see the Baby\'s age at image creation date.'
         )
         return
     else:
         # Set image
         imgView = self._ui['ImageView']
         imgView.image = ui.Image.from_data(appex.get_image_data())
         self._images = self.get_appex_attachments('image')
         if self._images:
             try:
                 self._now_img = self.get_image_creation_date(
                     self._images, 0)
             except NoEXIFDataError as ex:
                 print(ex.expr + ' -> ' + ex.msg)
             if self._now_img:
                 self._now = self._now_img
                 self._debug('EXIF.DateTimeOriginal',
                             self._strdate(self._now))
                 self._info_msg(
                     'Image creation date received from AppEx: ' +
                     self._strdate(self._now))
                 self._ui_set_context(Contexts.IMAGE.value)
                 self._calc()
             else:
                 self._err_msg(
                     'EXIF.DateTimeOriginal could not be converted into a date object.'
                 )
Ejemplo n.º 2
0
params = {
    'auth': {
        'api_key': apiKey,
        'api_secret': apiSecret
    },
    'wait': True,
    "convert": {
        "format": "jpeg"
    }
}

data = json.dumps(params)

if appex.is_running_extension() is True:
    image = appex.get_image_data()
else:
    image = photos.pick_image(original=True, raw_data=True)

print('Uploading to Kraken...')
console.show_activity()

request = requests.post(url='http://api.kraken.io/v1/upload',
                        files={'name': (name, image)},
                        data={'data': data})

response = json.loads(str(request.content))

if (response['success']):
    console.hud_alert('Lossless image uploaded to Kraken.', 'success')
else:
Ejemplo n.º 3
0
# coding: utf-8

# https://forum.omz-software.com/topic/3520/gives-an-error-at-the-line-that-i-marked

import ui
import appex
import Image


v = ui.load_view()
#img = appex.get_image()
#if img:
	#v["image"].image = ui.Image(str(img)) #Error occurs here, it says IOError couldn't display image or something like that
img_data = appex.get_image_data()
if img_data:
	v['image'].image = ui.Image.from_data(img_data)
# ...
v.present('sheet')
if not img:
	v.close()