Title: media.php help about thumbnails src
Last modified: August 20, 2016

---

# media.php help about thumbnails src

 *  [etchel1](https://wordpress.org/support/users/etchel1/)
 * (@etchel1)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/mediaphp-help-about-thumbnails-src/)
 *     ```
       function wp_get_attachment_image($attachment_id, $size = 'thumbnail', $icon = false, $attr = '') {
   
       	$html = '';
       	$image = wp_get_attachment_image_src($attachment_id, $size, $icon);
       	if ( $image ) {
       		list($src, $width, $height) = $image;
       		$hwstring = image_hwstring($width, $height);
       		if ( is_array($size) )
       			$size = join('x', $size);
       		$attachment =& get_post($attachment_id);
       		$default_attr = array(
       			'src'	=> $src,
       			'class'	=> "attachment-$size",
       			'alt'	=> trim(strip_tags( get_post_meta($attachment_id, '_wp_attachment_image_alt', true) )), // Use Alt field first
       			'title'	=> trim(strip_tags( $attachment->post_title )),
       		);
       		if ( empty($default_attr['alt']) )
       			$default_attr['alt'] = trim(strip_tags( $attachment->post_excerpt )); // If not, Use the Caption
       		if ( empty($default_attr['alt']) )
       			$default_attr['alt'] = trim(strip_tags( $attachment->post_title )); // Finally, use the title
   
       		$attr = wp_parse_args($attr, $default_attr);
       		$attr = apply_filters( 'wp_get_attachment_image_attributes', $attr, $attachment );
       		$attr = array_map( 'esc_attr', $attr );
       		$html = rtrim("<img $hwstring");
       		foreach ( $attr as $name => $value ) {
       			$html .= " $name=" . '"' . $value . '"';
       		}
       		$html .= ' />';
       	}
   
       	return $html;
       }
       ```
   
 * I’m talking about the thumbnails here. at this part:
 * `'src' => $src,`
 * I want to add something on it but I’m very PHP noob. Don’t worry, I will make
   a function at my functions.php add and remove filter. I won’t edit the core files.
 * the example output is [http://www.example.com/image.jpg](http://www.example.com/image.jpg)
   right?
    now I want to put something beside it either at the beginning or at the
   end. like this.
 * `image.php?http://www.example.com/image.jpg`
 * see the difference? it added image.php? right?
    can anyone tell me how to do 
   that?

Viewing 1 replies (of 1 total)

 *  Moderator [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * (@keesiemeijer)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/mediaphp-help-about-thumbnails-src/#post-2403721)
 * Maybe this:
 *     ```
       'src' => 'image.php?' . $src,
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘media.php help about thumbnails src’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * Last activity: [14 years, 6 months ago](https://wordpress.org/support/topic/mediaphp-help-about-thumbnails-src/#post-2403721)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
