humanmade / WPThumb

:warning: UNMAINTAINED :warning: On demand image resizing for WordPress
https://humanmade.co.uk/wpthumb/
170 stars 32 forks source link

WPThumb Shortcode #35

Closed Thunderlab closed 11 years ago

Thunderlab commented 12 years ago

I create a simple shortcode to insert external images. Here is the code:

function image_shortcode($atts) {
extract(shortcode_atts( array(
"url" => '',
"width" => '',
"height" => '',
"crop" => ''
), $atts));
$img = wpthumb($url,'width='.$width.'&height='.$height.'&crop='.$crop.'');
return "<img src='$img'/>";
} add_shortcode( 'img', 'image_shortcode' );

Usage [img url="http://...theimage.jpg" width="100" height="100" crop="1"]

joehoyle commented 11 years ago

this is a very interesting idea, let's decide on a shortcode name

[wpthumb httpgoogle.com.xom width=40]

Perhaps?

I think we coud not have an arg for the URL, easier to use maybe

joehoyle commented 11 years ago

cc @willmot @mattheu

willmot commented 11 years ago

Thats a great idea.

[wpthumb httpgoogle.com.xom width=40]

Could we scrap the http?

joehoyle commented 11 years ago

Could we scrap the http?

Yes I think so

mattheu commented 11 years ago

Really good idea.

Should be able to specify attachment ID instead of URL.

Would almost like to see all images inserted like this - Makes it much easier to filter the output - currently impossible to do this on old posts- eg replace with

joehoyle commented 11 years ago

Yes, only downside if one is locking themselves into wpthumb for images in their posts, maybe we could have an uninstall optino or something to go through posts and put in the image

willmot commented 11 years ago

Is there a standard WordPress image shortcode that we could just overload? That way we could be backwards compatible.

joehoyle commented 11 years ago

pretty sure there is not

mattheu commented 11 years ago

Yeah don't think there is.

Could have a compatibility plugin that uses the same shortcode to output the image without wpthumbing it

joehoyle commented 11 years ago

Closed for p/r in #56