內容簡介
ChoiceCuts Image Juggler 可輕鬆處理所有圖像處理。剝離圖像,調整到橫向,調整到縱向以及建立縮略圖。您可以輕鬆地在流程中加入幾個簡易的燈箱,以呈現圖像的原本精華。使用新的管理畫面現在很容易啟用全站圖像處理。有幾個選項可供選擇。
對於不怕進行一些模板自定義的 WordPress 用戶,該函式庫仍然可用於非常簡單的圖像處理。
此外,該外掛程序的主要目的是讓經常使用 WordPress 的用戶更輕鬆地處理圖像,同時為主題和模板開發人員提供一個超出 WordPress 本地圖像調整選項限制的工具。只需在文章內容的任何地方上傳完整大小的文章圖像,插件即可為其處理一切!
該插件使用 PHP Thumbnail library (http://phpthumb.gxdlabs.com)。
插件主頁:www.workwithchoicecuts.com
使用示例
僅顯示第一個圖像作為橫幅
– 從當前文章中獲取第一個圖像,並將其輸出為 480 像素 x 100 像素,然後從文章內容中刪除所有其他圖像。
<< php code start >>
the_post();
$postContent = get_the_content();
ccImj_firstLandscape( $postContent, 480, 100 );
echo ccImj_noImg( $postContent );
<< php code end >>
為博客類別中最近的十篇文章創建縮略圖
– 從博客類別中獲取所有文章,並將它們作為 60 像素正方形縮略圖輸出,以及文章標題和摘要。
<< php code start >>
query_posts( “category_name=Blog&showposts=10&orderby=date&order=DESC” );
while(have_posts()) {
the_post();
$postContent = get_the_content();
ccImj_firstThumb( $postContent, 60, get_permalink() );
the_title();
the_excerpt();
}
<< php code end >>
完整的插件 API
N.B. 所有函式的技術文件在插件代碼中得到了說明。更多信息,請閱讀插件安裝文件夾中的 cc_image_juggler.php 文件。
// ———————————————————————– 圖像提取工具
ccImj_getFirstImg
– 從傳遞的 $content 中提取第一個圖像,僅返回圖像文件路徑
<< php code start >>
$image = ccImj_getFirstImg( $postContent ); ?>
<< php code end >>
ccImj_getAllImg
– 從傳遞的 $content 中提取所有圖像,返回一個多維數組。返回的數組包含每個發現的圖像元素。每個元素內部都是一個關聯數組,格式如下:[‘tag’] – 完整的 html img 標籤。[‘url’] – 僅為圖像文件路徑。
<< php code start >>
$images = ccImj_getAllImg( $postContent ); ?>
<< php code end >>
ccImj_noImg
– 從傳遞的參數(通常是文章內容)中刪除所有圖像
<< php code start >>
$contentWithoutImages = ccImj_noImg( $postContent ); ?>
<< php code end >>
// ———————————————————————–
外掛標籤
開發者團隊
② 後台搜尋「ChoiceCuts Image Juggler」→ 直接安裝(推薦)
📦 歷史版本下載
原文外掛簡介
ChoiceCuts Image Juggler makes all image handling a piece of cake. Stripping images, resizing to Landscape, resizing to Portrait and creating Thumbnails are all handled. A couple of lightboxes can easily be slipped into the process so as present your images in their original glory. Using the new admin screen it is now very easy to activate site wide image juggling. There are several options to choose from.
For WordPress users who are not afraid to do some template customisation, the library of functions is still available to do some great things with images, very simply.
The core aim of this plugin is to make the life of someone who regularly uses WordPress a lot easier, in so far as to remove the need to do any image resizing while at the same time giving theme and template developers a tool to go way beyond the restricted, native image resize options of WordPress. Just upload post images at full size, anywhere within the content of your post, then the plugin will take care of everything else!
The plugin uses the fantastic PHP Thumbnail library by http://phpthumb.gxdlabs.com.
Plug-in Homepage: www.workwithchoicecuts.com
Usage Exmaples
SHOW JUST THE FIRST IMAGE AS A LANDSCAPE BANNER
– Get the first image from the current Post and output it as a 480px x 100 px and remove all other images from Post Content.
<< php code start >>
the_post();
$postContent = get_the_content();
ccImj_firstLandscape( $postContent, 480, 100 );
echo ccImj_noImg( $postContent );
<< php code end >>
CREATE A THUMBNAIL FOR EACH OF 10 MOST RECENT POSTS IN THE BLOG CATEGORY
– Get all posts from the ‘Blog’ category and output them as 60px square thumbnails, as well as the post title and post excerpt.
<< php code start >>
query_posts( “category_name=Blog&showposts=10&orderby=date&order=DESC” );
while(have_posts()) {
the_post();
$postContent = get_the_content();
ccImj_firstThumb( $postContent, 60, get_permalink() );
the_title();
the_excerpt();
}
<< php code end >>
Full Plugin API
N.B. All functions are technical documented within the plugin code. Read through file cc_image_juggler.php within the plugin install folder for more information.
// ————————————————————————– IMAGE EXRACTION UTILITIES
ccImj_getFirstImg
– extract the first image from passed $content, return image file path only
<< php code start >>
$image = ccImj_getFirstImg( $postContent ); ?>
<< php code end >>
ccImj_getAllImg
– extract all images from passed $content, returns a multi-dimensional array. The returned array contains an element for each image found. Within each element is an associative array as follows: [‘tag’] – full html img tag. [‘url’] – image file path only.
<< php code start >>
$images = ccImj_getAllImg( $postContent ); ?>
<< php code end >>
ccImj_noImg
– remove all images from the passed parameter, typically post content
<< php code start >>
$contentWithoutImages = ccImj_noImg( $postContent ); ?>
<< php code end >>
// ————————————————————————– IMAGE MANIPULATION PREPARATION
ccImj_resizeWidthURL
– resize image to specified width, pass min_height to ensure consistent image dimensions. Return only the image resize URL, without embedding any HTML tags
<< php code start >>
$resizeUrl = ccImj_resizeWidthURL( $img_path, 480, 120 ); ?>
<< php code end >>
ccImj_resizeHeightURL
– resize image to specified height. Return only the image resize URL, without embedding any HTML tags
<< php code start >>
$resizeUrl = ccImj_resizeHeightURL( $img_path, 300 ); ?>
<< php code end >>
ccImj_resizeWidth
– resize image to specified width. Return full HTML IMG tag for resized image
<< php code start >>
$image_html = ccImj_resizeWidth( $img_path, 480, ‘class=”special-image-style” rel=”ajax-link-code-13″‘ ); ?>
<< php code end >>
ccImj_resizeHeight
– resize image to specified height. Return full HTML IMG tag for resized image
<< php code start >>
$image_html = ccImj_resizeHeight( $img_path, 300, ‘class=”special-image-style”‘ ); ?>
<< php code end >>
ccImj_cropLandscape
– proportionally resize image to specified width, then crop excess height as required
<< php code start >>
$image_html = ccImj_cropLandscape( $img_path, 300, 240 ); ?>
<< php code end >>
ccImj_cropPortrait
– proportionally resize image to specified height, then crop excess width as required
<< php code start >>
$image_html = ccImj_cropPortrait( $img_path, 300, 240, ‘class=”special-image-style” alt=”Your Blog”‘ ); ?>
<< php code end >>
ccImj_cropSquareCtr
– resize image to specified size, then crop a square from the centre
<< php code start >>
$image_html = ccImj_cropSquareCtr( $img_path, 60, ‘class=”special-image-style”‘ )
<< php code end >>
// ————————————————————————– ‘GET FIRST’ FUNCTIONS
ccImj_firstLandscape
– extract the first image from the passed content, resize image to specified width, crop the excess if required and wrap it in a hyperlink if desired
<< php code start >>
ccImj_firstLandscape( $postContent, 480, TRUE, FALSE, ‘class=”special-image-style”‘ ); ?>
<< php code end >>
ccImj_firstPortrait
– extract the first image from the passed content, resize image to specified height, crop the excess if required and wrap it in a hyperlink if desired
<< php code start >>
ccImj_firstPortrait( $postContent, 600, TRUE, FALSE, ‘class=”special-image-style”‘ ); ?>
<< php code end >>
ccImj_firstThumb
– extract the first image from the passed content, then crop a square from the centre and wrap it in a hyperlink if desired
<< php code start >>
$image_html = ccImj_firstThumb( $content, 130, FALSE, TRUE, ‘class=”thumbnail-image-style”‘ ); ?>
<< php code end >>
// ————————————————————————– RESIZE & CROP PASSED IMAGE FUNCTIONS
ccImj_linkedLandscape
– resize image to specified width and height, then wrap it in a hyperlink if desired
<< php code start >>
ccImj_linkedLandscape( $img_path, 600, 200, FALSE, FALSE, ‘class=”mega-banner”‘ ); ?>
<< php code end >>
ccImj_linkedPortrait
– resize image to specified height and width, then wrap it in a hyperlink if desired
<< php code start >>
$your_variable = ccImj_linkedPortrait( $img_path, 400, 180, TRUE, TRUE, ‘class=”thumbnail-image-style”‘ ); ?>
<< php code end >>
ccImj_linkedThumb
– resize image to specified size, then crop a square from the centre and wrap it in a hyperlink if desired
<< php code start >>
ccImj_linkedThumb( $img_path, 200, ‘http://www.workwithchoicecuts.com’, FALSE, ‘class=”thumbnail-image-style”‘ )
<< php code end >>
// ————————————————————————– FILTER ALL FUNCTIONS
ccImj_flexiWidth
– resize all images, to be within specified width sizes, in every post. if image is larger than max_width resize and present original via lightbox, or if smaller than min_width resize up to min_width.
** To use this function edit the constant ‘FILTER_FLEXI_WIDTH’ value to be TRUE. Find this at the top of the plugin code.
ccImj_allWidth
– resize all images, to specified width, and wrap it in a hyperlink if desired
** To use this function edit the constant ‘FILTER_ALL_WIDTH’ value to be TRUE. Find this at the top of the plugin code.
ccImj_allCrop
– resize all images, to specified square thumbnail size, in every post to specified height and wrap it in a hyperlink if desired
** To use this function edit the constant ‘FILTER_ALL_CROP’ value to be TRUE. Find this at the top of the plugin code.
