开发者

Wrap URL in php code - Wordpress

I have a set of code that modifies the native wordpress gallery:

/* Open the element to wrap the image. */
    $output .= "\n\t\t\t\t\t\t<{$icontag} class='gallery-icon'>";

    /* Add the image. */
    $image = ( ( isset( $attr['link'] ) && 'file' == $attr['link'] ) ? wp_get_attachment_link( $id, $size, false, false ) : wp_get_attachment_link( $id, $size, true, false ) );
    $output .= apply_filters( 'cleaner_gallery_imag开发者_开发问答e', $image, $id, $attr, $cleaner_gallery_instance );

    /* Close the image wrapper. */
    $output .= "</{$icontag}>";

The outputs something like this:

<dt class="gallery-icon">
     <a title="ambrosia (4)" href="URL">
        <img width="150" height="93" title="ambrosia (4)" alt="ambrosia (4)" class="attachment-thumbnail" src="URL">
     </a>
</dt>

I need to wrap the img src URL in a thumb.php resizer like this:

HOMEURL/thumb.php?src=IMGURL&w=234&h=250&zc=1&q=90

Is this possible? How would I do it?

Thanks, Zeem


If your image resize script is on the same server as the image itself, i would rather pass only the image name/id/rel.path instead of the whole URL. Giving a whole url would allow anybody to use your script as image resizer...

About how to modify th html itself, i suggest you look into that wp_get_attachment_link() function and see what it does :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜