I’m trying to convert a rather old kirby page to a new version with blocks instead of kirbytext fields. As the most pages are not that complex, I’m using Blocks::parse() for that. This works good except with images.
parse is creating image blocks but obviously referecing them with a web location an with the mediaUrl.
So I thought of just rewriting that block to a kirby location but I’m not getting behind this. My last approach was rather “harsh” because I thought there might be some problems when using update() on a blocks content but… it’s not working that way:
I fed the $page->update() with the blocks collection because I thought Kirby would handle this directly. I now converted the collection to an array, did an json_encode and now every works like it should.
Yes, the strange thing is that I wrote a recipe that works with just the blocks in the past, as if something changed in the meantime. Have to check this and adapt the recipe if necessary.