Title: Image srcset and alt
Last modified: March 16, 2024

---

# Image srcset and alt

 *  Resolved [Degas](https://wordpress.org/support/users/degas/)
 * (@degas)
 * [2 years ago](https://wordpress.org/support/topic/image-srcset-and-alt/)
 * Hi, pulling through an image using the standard
 *     ```wp-block-code
       <code>
       <img src="<?php block_field( 'pets-photo' ); ?>" />
       </code>
       ```
   
 * generates the full size URL. Is there a simple way to adapt this to include an
   Srcset or similar for different device sizes, and pull through the image’s alt
   text, or do we have to work with block_value() instead?
 * Thanks

Viewing 1 replies (of 1 total)

 *  Plugin Contributor [Ryan Kienstra](https://wordpress.org/support/users/ryankienstra/)
 * (@ryankienstra)
 * [2 years ago](https://wordpress.org/support/topic/image-srcset-and-alt/#post-17681368)
 * Hi [@degas](https://wordpress.org/support/users/degas/),
 * Yes, `block_value()` is the way to do that.
 * That [will return](https://github.com/studiopress/genesis-custom-blocks/blob/936b6c75b16e686894920ddc8471ffd529c55f8b/php/Blocks/Controls/Image.php#L75)
   the image ID, and from that, you can get a `srcset` for a different size.

Viewing 1 replies (of 1 total)

The topic ‘Image srcset and alt’ is closed to new replies.

 * ![](https://ps.w.org/genesis-custom-blocks/assets/icon.svg?rev=2373248)
 * [Genesis Custom Blocks](https://wordpress.org/plugins/genesis-custom-blocks/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/genesis-custom-blocks/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/genesis-custom-blocks/)
 * [Active Topics](https://wordpress.org/support/plugin/genesis-custom-blocks/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/genesis-custom-blocks/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/genesis-custom-blocks/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Ryan Kienstra](https://wordpress.org/support/users/ryankienstra/)
 * Last activity: [2 years ago](https://wordpress.org/support/topic/image-srcset-and-alt/#post-17681368)
 * Status: resolved