A user asked me a few days ago how to get the image width and height of a custom-defined image size in WordPress. After searching through the WordPress source code, I couldn’t find a function that handled this. I suppose there really aren’t too many uses for it, but this user needed these values for a custom script, which at least intrigued me enough to write out a custom function to handle this.
In this tutorial, I’ll walk you through adding custom image sizes as well as getting these image sizes within your custom scripts.
This is not a complete tutorial on how images work in WordPress. I’ve previously written a tutorial on WordPress’ post image feature on my personal blog, but I didn’t delve into the details of adding custom sizes. I still highly recommend reading that tutorial if you want to look at few cool image features or learn more about how images work in WordPress.