Articles of images

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( […]

add_image_size not working

I am trying to resize an image using either the following code: add_image_size(‘poster-full’, 450, 9999, false); OR add_image_size(‘poster-full’, 450); I need it to be resized widthwise, and height should be proportional. When, I go and Run the Regenerate Thumbnails Plugin, i see that the image is resized correctly. For both the above cases. But, when […]

Search by Attachment ID

I’m building a stock photo page for my company where we upload all photos our staff created so that it can be used later. It shows the ID of the image by post->ID so that users can see it, note it and be useful later – just like any other stock photo website. However, when […]

How to apply image alt descriptions from media library?

Consider this hypothetical: I upload photo.jpg to my media library, but DO NOT provide an alt description there. I then use that photo across several different pages of my site. Ideally I would like a plugin to enable me to add the alt description to photo.jpg in my media library and have that applied to […]

Meta query for a custom taxonomy on attachment

I have a custom taxonomy “length” with 3 values [‘long’, ‘medium’, ‘short’] I have attached this taxonomy to attachments (using CPT UI) Upon viewing the taxonomy I can see that I have successfully added ‘long’ to an image as it shows “count = 1” However my query is returning no records. Array ( [post_type] => […]

Why do I have blury images in WordPress

It seems WordPress is doing an exceptionally bad job when it comes to re-sizing my images. In the media options I have set my image sizes to my liking. Most notably 857px wide for the medium thumbs, and set the quality to 100, as well as turned on sharpening. I have set the following in […]