You may be wondering what wp_get_attachment_img() does for WordPress. It’s a function that displays an image in your post. While several functions have the same structure, some provide additional markup and accept other parameters. WP_get_attachment_image() returns a string with an image as an attachment, or an empty string if it fails. For the most part, it returns an image.
The value returned by this function can be an integer, string, or array. The Image ID return type is used to generate HTML for the image, and the Image Object return type provides extra information about the image. You can use either of these return types to display the image. While using wp_get_attachment_image, be sure to check the required field size before calling the function. Unless you are using a custom field, the default value is 2048 pixels.