Crazy looking code that's generated when trying to download the h5p file.

H5P Plugin in WordPress Giving You Crazy Code on Download Attempt?

We ran into this yesterday and it led to all kinds of other nonsense that wasn’t the issue. What was happening was that when you tried to Reuse>Download an existing H5P file it wouldn’t download it but would print the nonsense that is in the image above. We ended up going down all kinds of rabbit holes because we were also having an issue with permission and updating H5P libraries. Those issues weren’t related at all but did eat up some serious time. Those things tend to snowball and I end up adding a wheeluser in WHM so I can SSH into a sub-install and mess with folder/file permissions via terminal.1 Anyway, what interests me in some ways is that I finally gave up and posted for help on Twitter at 8:07 this morning. I hate to ask people for help if I haven’t worked pretty hard at solving something. Early in the hope game but I'm thinking it's a mime type issue. Not sure why it appeared suddenly though. — Tom Woodward (@twoodwar) September 22, 2020 By 9:00AM my brain finally kicked loose where I’d seen that weird code-like stuff before . . . expletive-string2 mime types. A bit of Stackoverflow later and I was able to add the following to the .htaccess file and fix the issue by […]

Forest xGump on a bench with the text simple is as simple does.

Make H5P Quiz Images Go Big by Default

When you add images to H5P questions, the default behavior is to present them small. You can then click to make them go full size. We didn’t want to do that with the histology stuff. Luckily you can override the css as described here. I didn’t test this against other H5P options so it may do more than other people would like but we’re only using quizzes so this is fine. Jeff also got us most of the way there with some javascript and could have done it all that way as well.

H5P embed advanced options showing the dynamic sizing script option.

H5P Default Dynamic Sizing

If you’re running the H5P plugin in WordPress, you might notice that there’s an advanced settings option when you go to embed it. If you click on that you’ll see an additional script to add to enable dynamic sizing of embedded H5P content. I wanted that but that option doesn’t make much sense in our environment. If you read this blog a lot and have an amazing memory, you’ll know I have a plugin that’s network activated where I put little things that make sense but don’t need their own dedicated plugin. This seemed like one that fits that bill. It’s really simple. It asks if the site is running H5P and if the answer is yes, it enqueues the h5p-resizer.js.