Make WordPress Core


Ignore:
Timestamp:
11/23/2008 06:37:15 AM (17 years ago)
Author:
azaozz
Message:

Gallery settings for TinyMCE

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/media.php

    r9688 r9847  
    523523 * @param string $size Optional, default is 'thumbnail'.
    524524 * @param bool $icon Optional, default is false. Whether it is an icon.
     525 * @param int $imgwidth Override image width.
    525526 * @return string HTML img element or empty string on failure.
    526527 */
    527 function wp_get_attachment_image($attachment_id, $size = 'thumbnail', $icon = false) {
     528function wp_get_attachment_image($attachment_id, $size = 'thumbnail', $icon = false, $imgwidth = false) {
    528529
    529530    $html = '';
     
    531532    if ( $image ) {
    532533        list($src, $width, $height) = $image;
    533         $hwstring = image_hwstring($width, $height);
     534        $hwstring = $imgwidth ? image_hwstring($imgwidth, '') : image_hwstring($width, $height);
    534535        if ( is_array($size) )
    535536            $size = join('x', $size);
     
    619620        'columns'    => 3,
    620621        'size'       => 'thumbnail',
     622        'imgwidth'   => ''
    621623    ), $attr));
    622624
     
    638640    $columns = intval($columns);
    639641    $itemwidth = $columns > 0 ? floor(100/$columns) : 100;
     642    $imgwidth = isset($imgwidth) && (int) $imgwidth ? $imgwidth : false;
    640643
    641644    $output = apply_filters('gallery_style', "
     
    661664    $i = 0;
    662665    foreach ( $attachments as $id => $attachment ) {
    663         $link = wp_get_attachment_link($id, $size, true);
     666        $link = isset($attr['link']) && 'file' == $attr['link'] ? wp_get_attachment_link($id, $size, false, false, $imgwidth) : wp_get_attachment_link($id, $size, true, false, $imgwidth);
     667
    664668        $output .= "<{$itemtag} class='gallery-item'>";
    665669        $output .= "
Note: See TracChangeset for help on using the changeset viewer.