Editorial Workflows

Insert Image...

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: Saves an image from the camera roll as a jpeg file in the current document's directory, and inserts a markdown image reference.

Shared by: @olemoritz

Comments: Comment Feed (RSS)

Lorenz — 04 Jun 2015
Nice work! I just have a little suggestion: I think it would be handy to save the image inside a new folder that has the same name as the document currently open but with a suff such as '_images' at the end. This way one document can always be associated with its images.
anonymous — 20 Jan
Doesn't seem to work in new version1.3 :(

+ Add Comment

Workflow Preview
A document has to be open... ?
Run the block if
File Name
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
Stop ?
  • This Workflow
  • Repeat Block
Show HUD Alert
No Document Selected
…End If
Run Python Script ?
Source Code
#coding: utf-8
import photos
import workflow
import console
import editor
import os
import io

img = photos.pick_image()
if not img:

doc_path = editor.get_path()
doc_dir, fn = os.path.split(doc_path)
default_name = 'Image'
i = 1
while True:
	if not os.path.exists(os.path.join(doc_dir, default_name + '.jpg')):
	default_name = 'Image_' + str(i)
	i += 1

root, rel_doc_path = editor.to_relative_path(editor.get_path())
filename = console.input_alert('File Name', 'The image will be saved in the folder of the current document.', default_name + '.jpg', 'Save')
if not filename:
img_data = io.BytesIO()
img.save(img_data, 'jpeg')
rel_doc_dir, fn = os.path.split(rel_doc_path)
dest_path = os.path.join(rel_doc_dir, filename)
editor.set_file_contents(dest_path, img_data.getvalue(), root)
Replace Selected Text ?
Replacement Text