Articles of images

WordPress lowers image quality

I am uploading to my site large images with media uplader and I want them to have 100% quality but wordpress reduces the quality. What should I do or what plugin to install to prevent this?

Image rotation issue (horizontal picture uploading as vertical) — Exif issue?

I am building a classifieds site on WordPress where users can upload their ads/images from front-end. However, when horizontal pictures are uploaded, they upload as vertical. I looked into the issue and found the following suggested solution for fixing image orientation using its Exif data: //read EXIF header from uploaded file $exif = exif_read_data($_FILES[‘ImageFile’][‘tmp_name’]); //fix […]

How to test if there are no more previous or next image on attachment page?

I have a next_image_link and previous_image_link as a navigation on my image.php but I want the first and last image to echo greyed out text (disabled button) to show prev button and next button. Right now, my code doesn’t echo it when you are in the first or last image. < | next > I […]

Images don't load erratically

Images load erratically or don’t load at all on the pages of https://imsgeneva.ch. For example, https://imsgeneva.ch/the-school/ 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() […]