Convert image

Convert image [Paid] 5.1

No permission to buy ($35.00)
Now that we all have tens of thousands or more images hosted on our forum, a nice complementary addon would be to have them load from a CDN. This requires just a simple URL change if you already have the CDN in place.
 
@AndyB I went to update a site from 2.6 to 2.8 but you changed from using guzzle to retrieve the remote file to instead using file_get_contents. That's now causing an issue for me as my php config has allow_url_fopen turned off (and till now I had no reason to open it up).

Was a there a reason for switching from the XF client to file_get_contents? 🤔 It seems to be a step backwards.
 
Is there a difference between this add-in and the add-on here
 
Convert Image All converts all existing hotlinked images using ACP > Rebuild Cache job (you first have to navigate to admin-only URL for add-on to add them to batch job). Convert Image converts images when a user posts them. You should use Convert Image All to convert all existing hotlinked images, then Convert Image going forward. You can also use Convert Image All periodically just using it's admin-only URL to convert images missed by Convert Image (e.g. when there is a timeout or failure).
 
Convert Image All converts all existing hotlinked images using ACP > Rebuild Cache job (you first have to navigate to admin-only URL for add-on to add them to batch job). Convert Image converts images when a user posts them. You should use Convert Image All to convert all existing hotlinked images, then Convert Image going forward. You can also use Convert Image All periodically just using it's admin-only URL to convert images missed by Convert Image (e.g. when there is a timeout or failure).
ok
thank you
 
Morning @AndyB

Just moved servers (cPanel) and I'm having trouble getting ImageMagick to work with this, even though XenForo and PHPinfo show it's installed/enabled. Any ideas?

1564148858961.webp

1564148821376.webp
 
Just moved servers (cPanel) and I'm having trouble getting ImageMagick to work with this, even though XenForo and PHPinfo show it's installed/enabled. Any ideas?
I believe PHP 7.2+ requires ImageMagick 7+ to work correctly. My install with Convert Image and PHP 7.2:

imagick.webp
 
So I was getting REALLY low conversion rates with this plugin. It took a bit to figure out why, but the reason turned out to be that the script doesn't set a user_agent. As such, many application firewalls such as mod_security automatically block requests from this script. By inserting a line at line 96 (or other place) of ConvertImage/Listener.php (right after "//continue if passed verifications"), I was able to -substantially- improve my success rate. After all, as convention firewall thinking goes, without a useragent, it must be a scraper instead of a legitimate browser or even a legitimate search engine crawler. I added:

ini_set('user_agent','Mozilla');
or
ini_set('user_agent','Mozilla/5.0');

If a firewall is being picky, maybe a legit useragent would work better, but the above works a whole lot better than nothing.

ini_set('user_agent','Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36');

I propose this be added to the code base...

Bottom line: With the addition of the user-agent, well worth the cost of membership.
 
Last edited:
One other thing worth mentioning... a problem I solved before the useragent was minimum and maximum image sizes. Even though I had minimum and maximum image sizes set in the add-on settings, it still didn't work and and simply generated a error "Maximum attachment image dimensions must be greater than zero". Which means exactly what it says. You have to go into settings->options->attachments and set maximum attachment image dimensions even though Xenforo defaults to '0' for max width and height (no limit). I only mention this in that maybe it will save one a few minutes. I was so focused on the max settings inside the add-on, that I didn't think it might be talking about a very similar setting elsewhere.
 
So I was getting REALLY low conversion rates with this plugin. It took a bit to figure out why, but the reason turned out to be that the script doesn't set a user_agent. As such, many application firewalls such as mod_security automatically block requests from this script. By inserting a line at line 96 (or other place) of ConvertImage/Listener.php (right after "//continue if passed verifications"), I was able to -substantially- improve my success rate. After all, as convention firewall thinking goes, without a useragent, it must be a scraper instead of a legitimate browser or even a legitimate search engine crawler. I added:
Doesn't XenForo have built-in Guzzle interface which would take care of this?
 
Doesn't XenForo have built-in Guzzle interface which would take care of this?
FYI (it's one of the reasons I switched to something else)

 
@AndyB it has only recently come to my attention that this add-on (and perhaps others) are violating the resource standards. Specifically:
If an add-on needs to make HTTP requests, it must use the XF HTTP client rather than making cURL requests manually.
It's disappointing to learn you were doing it correctly, and now you are not, for some reason.

This needs to be resolved in this resource and any others where you employ a similar functionality.

Can you please provide a time scale for resolving the issue?

If you're unable to resolve, we would have to insist that the resource is removed in its current state.
 
While I'm sure there must be a reasonable explanation, and you likely aren't the only person to occasionally not follow all of the standards, I should point out that it would be incredibly wise to ensure the standards are being followed now because if there was such a time in the future where there was closer scrutiny, it makes sense to be on top of it now.
 
Back
Top Bottom