I have a plugin that generates a gallery of user photos. Currently, it works using
img tags pointing to the user photo image. It attaches to the
I'm experimenting with converting to using data URLs. I'm able to generate them with no difficulty, but when I change the code to insert them into the page, requests to that page come back with zero content (i.e. zero length). However, I still get a 200 status code and I don't see any errors in my logs.
So, I'm wondering if WP has a limit on the size of page it will send. The data URLs add up to around 1MB, so I was wondering if that tripped it over some limit.
The salient code is:
$file = trailingslashit($upload_dir['basedir']) . 'userphoto/' . $image_file; $fileContents = base64_encode(file_get_contents($file)); error_log($fileContents); $src = "data:image/jpg;base64,$fileContents"; ... ... $img .= '<img src="' . htmlspecialchars($src) . '"'; ... $img .= ' />';
In case it's relevant, the content is in a page not a post and it would go here: http://nerdnite.com/nerds/
So, that page, but with data URLs instead of image source files.
What I do now know is that it's not the generation of the content string by the filter. I can generate the string (which is of length 1229923), but if I pass a dummy string back, everything works well.
My memory usage is negligible and I'm nowhere near my PHP limit... so it seems to be something to do with WordPress trying to handle that huge string.