okedan
Forum Replies Created
-
Forum: Plugins
In reply to: [WP Better Attachments] Add all sizes for attached imagesHi Dan,
Thank you very much for your cooperation.
I solved it! Since we’ve got all the image ID ‘s for the post in attached_images[] via wpba_get_attachments() in the JSON response, I created a separate array with the same keys as the attached_images. Then, I made individual JSON requests for each media ID to retrieve the different sizes, and pushed them onto the separate array. Et voila 🙂 Now we can loop over attached_images in the post with an $index (Angular) and use that $index as a reference in the separately created array.
This is far more efficient than pulling all images in. It’s only text, but still, I wanted a efficient way to solving this, as this project holds several hundred images.
Kind regards,
Bas
This plugin helped solve my problem: Content Security Policy WordPress Plugin.
Great! Hard to find a reference about it, though.
This solution works partially: https://forum.dokuwiki.org/thread/11642. Basically, you have to add this line to the .htaccess file:
Header set Content-Security-Policy “allow ‘self’; media-src *; img-src *; script-src ‘self’ ‘unsafe-inline’ https://ajax.googleapis.com http://www.google-analytics.com; style-src ‘self’ ‘unsafe-inline’;”
But partially! Now the CSS bloats too. Same error, but now it nags about inline CSS.
But the question remains: why is this happening out of the blue? And it’s not a permanent solution, it are fixes.