MyBB Hacks

Full Version: Request: support for external images
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I tried the image upload function, but because it uses PHP to display the image, it's slow and increases the server load.
The alternative is to use an external image (textfield). The problem is that doing it this way, the image isn't verified. I wrote a plugin to hook the verification, but I think it should by part of xthreads.
There is no reliable way to verify an image if it's not locally available.

I guess it could be possible to allow direct access to an image rather than force it through a PHP script.
What's wrong with getimagesize for width, height and MIME? I use that combined with CURL to verify that the file exists, and has an acceptable length.
It only fails with very bad servers that don't send the Content-Length header.
Checking the file once does not guarantee that it'll be valid forever.
Especially if you're trying to verify dimensions - it's trivial for a server admin to replace a small image with a larger one.

Thus verifying an arbitrary URL seems mostly pointless to me.  Perhaps the only thing I can think of is perhaps tell a clueless user that they need to supply an image link, though requring a .png/.jpg/whatever extension is probably suffice most of the time, and of course, the MyBB [img] tag does no such verification anyway.
I see your point. In my case, it doesn't matter, because I restrict the images to my own image gallery, but for uncontrolled external images, that may be a problem.
I guess selecting from a gallery is an interesting case, although somewhat limited in scope.  If there aren't many, you could stick to a select box input, but I presume you would've thought of that anyway, in which case you're probably stuck with your custom modification unfortunately.
Reference URL's