Ryan Pierce Posted June 23, 2013 Share Posted June 23, 2013 Is there a way to use the ProcessWire API to insert images into the text of a Markdown field? Something kind of like this: <?php $image1 = $page->image->url; ?>  The end goal here is to be able to write posts in a Markdown-like way but have ProcessWire handle all of the image paths and ordering. Link to comment Share on other sites More sharing options...
Adam Kiss Posted June 24, 2013 Share Posted June 24, 2013 It isn't, not with 'vanilla' PW. But there are already some modules that can give you this – search http://modules.processwire.com/ and it's pretty simple to roll your own. In case you want to build micromodule for yourself, to learn a little, do following: - create textformatter module – you'll add it to the textarea (before md parsing!) - comeup with some combination of letters not naturaly used in text - capture the text - find correct picture for it - replace the original text with pictures URL done. When I did this last time (can't share code due to licensing issues, but it was fun to build it nevertheless), it took something like 20-30 lines to do it (excluding PW's module structure), so… pretty simple. Link to comment Share on other sites More sharing options...
horst Posted June 24, 2013 Share Posted June 24, 2013 @RyanPierce: you may have a look to Hanna Code Link to comment Share on other sites More sharing options...
Ryan Pierce Posted June 25, 2013 Author Share Posted June 25, 2013 Thanks for the tips guys. This Hanna code looks interesting... Link to comment Share on other sites More sharing options...
Ryan Pierce Posted June 25, 2013 Author Share Posted June 25, 2013 Actually I think this is exactly what I was looking for. Hat tip to diogo and adamkiss. http://modules.processwire.com/modules/textformatter-image-tags/ Link to comment Share on other sites More sharing options...
Recommended Posts