There are still 17k sites using img_assist, and there's no upgrade path (image.module still doesn't have one), so it'd probably be incredibly helpful for a lot of people to have a migration directly from an img_assist-based site straight to a media.module-based site. I was wondering how hard it would be to implement this conversion as part of a mapping?
img_assist tags look like:
[img_assist|nid=49|title=|desc=|link=none|align=middle|width=500|height=526]
while media module tags look like this (link tag and style attributes added by CKeditor in WYSIWYG API):
<a href="blah">[[{"type":"media","view_mode":"media_large","fid":"13","attributes":{"alt":"","class":"media-image","style":"width: 349px; height: 480px; float: right;","typeof":"foaf:Image"}}]]</a>
Some of this is probably pretty straight forward and I can just rip the parsing/encoding code directly from the associated modules. But the file id would obviously depend on the migration from image.module to what ever other storage (I was assuming a similar setup - "image" content type with image field).
I will have a look further into it and re-open, but as I haven't jumped into migrate.module much yet, I'd be interested in any advice anyone can give.
Comments
Comment #1
mikeryanThe right place to add this would be in Migrate Extra's media module support.
Comment #2
mariagwyn commentedI would love to hear if anyone has made progress on this.
Maria
Comment #3
akejoha commentedDesperately needed..
Comment #4
albertczyk commentedmedia.inc file has a pretty good example that I've modified to do exactly what's described here. This is a working example, but I cannot get the JSON markup translated into HTML, so when displaying the node is shown in source format:
[[{"type":"media","view_mode":"media_large","fid":"410","attributes":{"alt":"En la casa-cuna Llar Natalis. Tarragona","title":"En la casa-cuna Llar Natalis. Tarragona","class":"media-image","typeof":"foaf:Image","wysiwyg":1}}]]It must be something silly, like a missing module or so... Does anybody have a clue?
Comment #5
albertczyk commentedYes, it was really silly: forgot to check "Convert Media tags to markup" in text formats config...
Comment #6
mikeryanThe place to do this would be MigrateDestinationMedia::rewriteImgTags(), add a line like:
after the existing preg_replace_callback call.
Implementation of replaceImgassistCallback is left as an exercise to the reader, patches welcome;).
Comment #6.0
mikeryanformatting