# A responsive image with the right alt text

> Print an image with its sizes and the alt text the editor wrote.

Source: https://uglydev.com/recipes/a-responsive-image-with-the-right-alt-text/
Updated: 19 November 2026

```php
<?php
$photo_id = ugly_get( 'photo' );

if ( $photo_id ) {
	echo wp_get_attachment_image(
		$photo_id,
		'large',
		false,
		array(
			'class'   => 'article__photo',
			'loading' => 'lazy',
			'sizes'   => '(min-width: 800px) 800px, 100vw',
		)
	);
}
```

The `alt` text comes from the media library, as always. Fill it in there.
