Articles of images

Images don't load erratically

Images load erratically or don’t load at all on the pages of For example, has an image that is consistently affected by the problem. However, they load when I request them from the server. I am baffled by this problem. Any help or pointers would be appreciated 😀

the_content not showing responsive image attributes srcset or sizes

I’m using WordPress 4.4.2, but am unable to get the new responsive images functionality to appear for the_content. It works for featured images, just not the_content images. I have no plugins installed (other than the default which aren’t active) and have tried using the themes that come with wordpress (twenty sixteen, twenty fifteen) but WordPress […]

Get post embedded image caption

I am trying to get the caption of post embedded images to then use on a lightbox. This is my code: function my_theme_prefix_content_gallery( $content ) { global $post; $args = array( ‘post_type’ => ‘attachment’, ‘post_mime_type’=>’image’, ‘numberposts’ => 1, ‘post_status’ => null, ‘post_parent’ => $post->ID, ); $attachments = get_posts( $args ); if ( $attachments ) { […]

Get all images out of the posts content

I try to get all images out of the content-area of a post. I already tried this $imgs = get_posts(array( ‘post_type’ => ‘attachment’, ‘post_per_page’ => -1, ‘post_parent’ => $thread->ID )); But this only returns the featured image / the post thumbnail. I also have tried $imgs = get_post_galleries_images($thread->ID); foreach($imgs as $img){ echo $img; } But […]

How to get image URL from media_sideload_image?

I upload external images for media library using following way. $new_image_url = media_sideload_image($new_url, $post_ID, $title); This method return complete img src tag or ‘src’ for the image URL. I need to get image URL from it?

Cleaning a filename after image sideloading a url that contains `%20`

Right now I’m creating a plugin to sideload images from an external source. The UI allows me to select files on the external server then downloads them via AJAX & media_sideload_image. Everything is working great. After the images is loaded I clean up the attachment’s title by replacing the dashes and underscores with spaces in […]

Weird encoded error when using wp_generate_attachment_metadata()

I’m AJAX POST-ing images to WordPress from another server and using a script to upload them into the WordPress file system. I get a strange output/error for the AJAX response, which I’ve narrowed down to the line: $attach_data = wp_generate_attachment_metadata( $attach_id, $filepath); I then further narrowed down the error to this line within the wp_generate_attachment_metadata() […]

Can't get text to wrap around image

I’m trying to get the text to wrap around my image on my about page here About But as you can see the text just sits at the bottom of the image, how can I make it wrap around the image and be up top at the start of the image to the right of […]

Can wp_get_image_editor convert to icon?

I have a very simple question regarding wp_get_image_editor ( I can crop, resize and save an image like this: $image = wp_get_image_editor( ‘example_1.jpg’ ); $image->resize( 32, 32, true ); $image->save( $path . ‘/test.png’ ); // Works with jpg/gif/png It works perfectly. I can convert a JPG file to GIF or PNG (and vice versa), but […]

Why does the Hard Crop option Scale?

I have a number of custom image sizes. I noticed earlier, when I was publishing a new post, that the post image was cropped AND scaled. It is exactly the right dimensions.. but it isn’t the portion of the image it should be. This is the code in functions.php, for this particular image size. add_image_size( […]