Tag Archive: images

Image Upload Adjustments

When uploading images, WordPress’ default behavior is to skip any defined image size if the uploaded image is too small to fill it. If the image’s width or height (but not both) is big enough, WP shrinks to fit within the rectangle but does not fill it. When both the width and height are big enough, WP always center-crops to ... 

Read article

Image Function Cheat Sheet

Simply a reference of the six image-related functions I use most often. I have this list printed out and keep it handy; for your convenience I’ve linked to the WP doc page for each.

In case you weren’t aware, many of these accept either a named size (e.g. ‘small’,'medium’,'full’,'your_custom_name’) or an array of [width,height] (e.g. array(300,200)).

wp_get_attachment_image

Returns HTML tag, something ... 

Read article

Preload Images

Here’s an easy way to manage your image preloads from anywhere in your PHP functions. We can simply build a globalized array of all image sources prior to outputting the page, then hook into the wp_footer action to output the required Javascript.

Each time your code encounters an image source that must be preloaded, simply call wpcx_add_preload_img($src) to add it to ... 

Read article