Title: Setting attachment size dynamically
Last modified: August 20, 2016

---

# Setting attachment size dynamically

 *  [richgcook](https://wordpress.org/support/users/richgcook/)
 * (@richgcook)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/setting-attachment-size-dynamically/)
 * Hi folks,
 * With the function `'wp get attachment image'` you can set the size to use, however,
   I am wanting the size to be set by whatever the user picks for the image in the
   media uploader. Is this possible? Currently we have to set ‘medium’, ‘full’ etc,
   but surely it would work if we could set whatever the user selects.
 * Currently my code looks like this:
 *     ```
       <ul class="project-individual-image-container">
       <?php
       $args = array(
       	'post_type' => 'attachment',
       	'post_status' => null,
       	'post_parent' => $post->ID,
       	'exclude'     => get_post_thumbnail_id(),
       	'order'       => ASC,
       	'orderby'	  => menu_order,
       	'post_mime_type' => 'image',
       	'numberposts'	=> -1,
       );
       $attachment_page = get_attachment_link( $attachment_id );
       $attachments = get_posts($args);
       	if ($attachments) {
       		foreach ($attachments as $attachment) {
       			echo '<li>'.wp_get_attachment_image($attachment->ID, '').'</li>';
       		}
       	}
       ?>
       </ul>
       ```
   
 * Thanks,
    Richard

Viewing 1 replies (of 1 total)

 *  Thread Starter [richgcook](https://wordpress.org/support/users/richgcook/)
 * (@richgcook)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/setting-attachment-size-dynamically/#post-3215458)
 * Choosing a size from the ‘Add media’ screen doesn’t seem to do anything.
 * _[ Please do not bump, that’s [not permitted here](http://codex.wordpress.org/Forum_Welcome#No_Bumping).]_

Viewing 1 replies (of 1 total)

The topic ‘Setting attachment size dynamically’ is closed to new replies.

## Tags

 * [attachment](https://wordpress.org/support/topic-tag/attachment/)
 * [image](https://wordpress.org/support/topic-tag/image/)
 * [media](https://wordpress.org/support/topic-tag/media/)

 * 1 reply
 * 1 participant
 * Last reply from: [richgcook](https://wordpress.org/support/users/richgcook/)
 * Last activity: [13 years, 6 months ago](https://wordpress.org/support/topic/setting-attachment-size-dynamically/#post-3215458)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
