How to use lossless compression with WP_Image_Editor

With @jgraup ‘s help in comments, I had a look at the responsive images plugin linked there. While that particular one has several other filters on things like post content which I would have preferred not to use, the RespImg class included is exactly what I was wanting. I was originally considering what would be … Read more

wordpress images not showing properly

I would check the upload_path upload_url_path under your admin options. I suspect they are still referencing the other website. Go to https://yourdomain.com/wp-admin/options.php and scroll down till you get to the the upload_path and upload_url_path.

Images Wont Display After Importing From Old WordPress

WordPress generate some smaller images (the thumbnails) so, the images are on your server, but thumbnails are not. If the issue is just a thumbnail rebuild, you can do rebuild them with this plugin: https://wordpress.org/plugins/ajax-thumbnail-rebuild/ With lucky you will not need to do anything else. But thumbnails sizes are defined per theme, plugin or even … Read more

Different body image backgrounds on different pages, posts and categories

You need to add the classes for the corresponding cases. For pages/posts: $css = “body.page-id-**post_id** { background-image: url(‘$bg_image’); }”; For categories: $css = “body.category-**category_id** { background-image: url(‘$bg_image’); }”; You can retrieve post_id with $post->ID. For the category you need to check whether the page is_archive() and to append the corresponding ID or category name.

Query Image File of a Different Size

I’m not quite sure what data is in your get_field(‘image’) but it sounds like you want all the metadata associated with an image. To do that just pass the $id to wp_get_attachment_metadata(). The result would be: Array ( [width] => 2400 [height] => 1559 [file] => 2011/12/press_image.jpg [sizes] => Array ( [thumbnail] => Array ( … Read more