Editorial Workflows

CDN

public workflow

Install Workflow...

This workflow contains at least one Python script. Only use it if you trust the person who shared this with you, and if you know exactly what it does.

I understand, install the workflow!

This is a workflow for Editorial, a Markdown and plain text editor for iOS. To download it, you need to view this page on a device that has the app installed.

Description: This workflow has no description.

Shared by: @viticci

Comments: Comment Feed (RSS)

There are no comments yet.

+ Add Comment

Workflow Preview
Run Python Script ?
Source Code
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Script: 	msia.py Version 1.0 
# Author:	Don Southard aka @binaryghost
# Date:		December 5, 2012
# Modified for Pythonista
# Modified Date: January 19, 2013
# Resize function from Macdrifter
# http://www.macdrifter.com/2012/11/the-power-of-pythonista-12.html
 
import cloudfiles
import time
import os
import clipboard
import Image
from io import BytesIO
import sys
import photos
import workflow
import console
import keychain
 
USERNAME = 'username'
API_KEY = keychain.get_password('rackspace','username')
BUCKET = 'BucketName'
 
def random():
	return int(time.time())
 
def getImageName():
	return 'image-%s.jpeg' % random()
 
def watermarkImage(image):
	pass
 
def uploadToRackspace(image):
	console.show_activity()
	connection = cloudfiles.get_connection(username=USERNAME, api_key=API_KEY, serviceNet=True)
	container = connection.get_container(BUCKET)
	fileName = getImageName()
	object = container.create_object(fileName)
	bytes = BytesIO()
	image.save(bytes, format='JPEG', quality=90)
	object.send(bytes.getvalue())
	workflow.set_output(object.public_uri())
	console.hide_activity()
	
def main():
	image = clipboard.get_image()
	if not image:
		image = photos.pick_image(show_albums=True)
	uploadToRackspace(image)
		
 
if __name__ == '__main__':
	main()
Set Variable ?
Variable Name
imageURL
Value
Input
Show Alert ?
Title
Image Uploaded
Message
Choose what to do next.
Button 1
Copy URL
Output Value
copy
Button 2
Insert
Output Value
insert
Button 3
Copy and Open
Output Value
copyopen
Show Cancel Button
ON
If… ?
Run the block if
Input
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
insert
Request Text Input ?
Title
Image Title
Initial Text
  • Single Line
  • Multiple Lines
Keyboard Options:
Set Variable ?
Variable Name
title
Value
Input
Replace Selected Text ?
Replacement Text
<img src="imageURL" href="imageURL" alt="title" title="title" class="aligncenter" />
…End If
If… ?
Run the block if
Input
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
copy
Generate Text ?
Text
imageURL
Set Clipboard ?
Show HUD ?
HUD Text
URL copied
Duration
  • 1 Second
  • 2 Seconds
  • 3 Seconds
Icon
  • "Success"
  • "Error"
…End If
If… ?
Run the block if
Input
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
copyopen
Generate Text ?
Text
imageURL
Set Clipboard ?
Open URL ?
Open in
  • In-App Browser
  • Default App / Safari
URL
imageURL
Tab
  • Last-used Tab
  • New Tab
  • Tab with ID:
Unique identifier
Wait until Loaded
OFF
Reveal Browser Automatically
ON
…End If