Editorial Workflows

InsertImageURL

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: Select the text in the editor you want the image to have. Be sure that the browser shows the web page where you want to pick an image from. Then invoke this workflow.
After a short while you'll be presented with an overview of all the images from that web page. Just tap on the one whose URL you want to have inserted into your markdown text as an inline link.
[This workflow needs the workflow "InsImgUrlB", too, to work!]

Shared by: @metawops

Comments: Comment Feed (RSS)

anonymous — 27 Jun 2014
Not working. Saying a command with some name is not found.
anonymous — 18 Dec 2014
Unfortunately this does not work. All you get are a few empty boxes which should presumably display images. After tapping on one of the boxes you get an error message.

A pity, this would be very useful.

+ Add Comment

Workflow Preview
Set Variable ?
Variable Name
html_doc
Value
Browser URL
If… ?
Run the block if
Browser URL
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
applewebdata
Show HUD ?
HUD Text
Getting images. Stay tuned!
Duration
  • 1 Second
  • 2 Seconds
  • 3 Seconds
Icon
  • "Success"
  • "Error"
Get Images from Browser URL ?
Source Code
#coding: utf-8
import workflow
import requests
import urllib
from urlparse import urlparse
from bs4 import BeautifulSoup

action_in = workflow.get_input()
#print action_in
if action_in:

	#print "Browser URL:", action_in

	htmlDoc = requests.get(action_in).text
	origUrl = urlparse(action_in)

	soup = BeautifulSoup(htmlDoc)
	#print(soup.prettify())
	#soup.find_all('img')

	targetHtml = '<html><head></head><body>'
	#print "Images URLs:"
	#print "------------"
	for image in soup.find_all('img'):
		imgUrl = image.get('src')
		o = urlparse(imgUrl)
		if not o.scheme:
			imgUrl = origUrl.scheme + '://' + origUrl.netloc + '/' + imgUrl
	#	print imgUrl
		targetHtml += "<a href='editorial://?command=InsImgUrlB&input=" + urllib.quote(imgUrl) + "'><img src='" + imgUrl + "'></a>&nbsp;"

	targetHtml += "</body></html>"
	#print targetHtml

	action_out = targetHtml

	workflow.set_output(action_out)
Show HTML ?
HTML
Input
Title
Select one
Base URL
None
Show HUD ?
HUD Text
Tap on the image to be linked to.
Duration
  • 1 Second
  • 2 Seconds
  • 3 Seconds
Icon
  • "Success"
  • "Error"
Stop ?
Stop
  • This Workflow
  • Repeat Block
Show HUD Alert
OFF
Message
Stopped
…End If
Show HUD ?
HUD Text
Please enter a URL in the browser!
Duration
  • 1 Second
  • 2 Seconds
  • 3 Seconds
Icon
  • "Success"
  • "Error"