[wordpress插件] ChoiceCuts Image JugglerChoiceCuts图片魔术师

wordpress 插件 文章 2020-03-23 05:40 594 0 全屏看文

AI助手支持GPT4.0

评分
0
描述

ChoiceCuts Image Juggler makes all image handling a piece of cake.

ChoiceCuts Image Juggler使处理所有图像变得轻而易举。

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.

对于不害怕进行模板自定义的WordPress用户,函数库仍然可以非常简单地处理图像。

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

此插件的核心目的是使经常使用WordPress的人的生活变得更加轻松,以至于无需进行任何图像大小调整,同时为主题和模板开发人员提供了一种工具,

go way beyond the restricted, native image resize options of WordPress.

超越了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.

该插件使用http://phpthumb.gxdlabs.com提供的出色的PHP Thumbnail库。

Plug-in Homepage: www.workwithchoicecuts.com

插件主页: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.

–从当前帖子中获取第一张图片并将其输出为480px x 100 px,并从帖子内容中删除所有其他图片。

<< php code start >>
    

<< PHP代码开始>>
    

the_post();
    

the_post();
    

$postContent = get_the_content();
    

$ postContent = get_the_content();
    

ccImj_firstLandscape( $postContent, 480, 100 );
    

ccImj_firstLandscape($ postContent,480,100);
    

echo ccImj_noImg( $postContent );

回声ccImj_noImg($ postContent);

<< php code end >>

<< php代码结尾>>

CREATE A THUMBNAIL FOR EACH OF 10 MOST RECENT POSTS IN THE BLOG CATEGORY

在博客类别中为每个最近的10条帖子创建一个缩略图

– Get all posts from the ‘Blog’ category and output them as 60px square thumbnails, as well as the post title and post excerpt.

–从“博客”类别中获取所有帖子,并将它们输出为60像素见方的缩略图,以及帖子标题和帖子摘录。

<< php code start >>
    

<< PHP代码开始>>
    

query_posts( “category_name=Blog&showposts=10&orderby=date&order=DESC” );
    

query_posts(“ category_name = Blog&showposts = 10&orderby = date&order = DESC”);
    

while(have_posts()) {
        

while(have_posts()){
        

the_post();
        

the_post();
        

$postContent = get_the_content();
        

$ postContent = get_the_content();
        

ccImj_firstThumb( $postContent, 60, get_permalink() );
        

ccImj_firstThumb($ postContent,60,get_permalink());
        

the_title();
        

the_title();
        

the_excerpt();
    

the_excerpt();
    

}

}

<< php code end >>

<< php代码结尾>>

Full Plugin API

完整插件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.

仔细阅读插件安装文件夹中的文件cc_image_juggler.php,以获取更多信息。

// ————————————————————————– IMAGE EXRACTION UTILITIES

// ————————————————————————图像提取工具

ccImj_getFirstImg

ccImj_getFirstImg

– extract the first image from passed $content, return image file path only

–从传递的$ content中提取第一张图片,仅返回图片文件路径

<< php code start >>
    

<< PHP代码开始>>
    

$image = ccImj_getFirstImg( $postContent );

$ image = ccImj_getFirstImg($ postContent);

?>

?>

<< php code end >>

<< php代码结尾>>

ccImj_getAllImg

ccImj_getAllImg

– extract all images from passed $content, returns a multi-dimensional array.

–从传递的$ content中提取所有图像,返回多维数组。

The returned array contains an element for each image found.

返回的数组包含找到的每个图像的元素。

Within each element is an associative array as follows: [‘tag’] – full html img tag.

每个元素内都有一个关联数组,如下所示:['tag'] –完整的html img标签。

[‘url’] – image file path only.

[‘url’] –仅图像文件路径。

<< php code start >>
    

<< PHP代码开始>>
    

$images = ccImj_getAllImg( $postContent );

$ images = ccImj_getAllImg($ postContent);

?>

?>

<< php code end >>

<< php代码结尾>>

ccImj_noImg

ccImj_noImg

– remove all images from the passed parameter, typically post content

–从传递的参数中删除所有图像,通常发布内容

<< php code start >>
    

<< PHP代码开始>>
    

$contentWithoutImages = ccImj_noImg( $postContent );

$ contentWithoutImages = ccImj_noImg($ postContent);

?>

?>

<< php code end >>

<< php代码结尾>>

// ————————————————————————– IMAGE MANIPULATION PREPARATION

// ————————————————————————图像处理准备

ccImj_resizeWidthURL

ccImj_resizeWidthURL

– resize image to specified width, pass min_height to ensure consistent image dimensions.

–将图像调整为指定的宽度,传递min_height以确保图像尺寸一致。

Return only the image resize URL, without embedding any HTML tags

仅返回图片调整大小的URL,而不嵌入任何HTML标签

<< php code start >>
    

<< PHP代码开始>>
    

$resizeUrl = ccImj_resizeWidthURL( $img_path, 480, 120 );

$ resizeUrl = ccImj_resizeWidthURL($ img_path,480,120);

?>

?>

<< php code end >>

<< php代码结尾>>

ccImj_resizeHeightURL

ccImj_resizeHeightURL

– resize image to specified height.

–将图像调整为指定的高度。

Return only the image resize URL, without embedding any HTML tags

仅返回图片调整大小的URL,而不嵌入任何HTML标签

<< php code start >>
    

<< PHP代码开始>>
    

$resizeUrl = ccImj_resizeHeightURL( $img_path, 300 );

$ resizeUrl = ccImj_resizeHeightURL($ img_path,300);

?>

?>

<< php code end >>

<< php代码结尾>>

ccImj_resizeWidth

ccImj_resizeWidth

– resize image to specified width.

–将图像调整为指定的宽度。

Return full HTML IMG tag for resized image

返回完整的HTML IMG标签以调整大小的图像

<< php code start >>
    

<< PHP代码开始>>
    

$image_html = ccImj_resizeWidth( $img_path, 480, ‘class=”special-image-style” rel=”ajax-link-code-13″‘ );

$ image_html = ccImj_resizeWidth($ img_path,480,``class =“ special-image-style” rel =“ ajax-link-code-13”');

?>

?>

<< php code end >>

<< php代码结尾>>

ccImj_resizeHeight

ccImj_resizeHeight

– resize image to specified height.

–将图像调整为指定的高度。

Return full HTML IMG tag for resized image

返回完整的HTML IMG标签以调整大小的图像

<< php code start >>
    

<< PHP代码开始>>
    

$image_html = ccImj_resizeHeight( $img_path, 300, ‘class=”special-image-style”‘ );

$ image_html = ccImj_resizeHeight($ img_path,300,``class =“ special-image-style”');

?>

?>

<< php code end >>

<< php代码结尾>>

ccImj_cropLandscape

ccImj_cropLandscape

– proportionally resize image to specified width, then crop excess height as required

–按比例将图像调整为指定的宽度,然后根据需要裁剪多余的高度

<< php code start >>
    

<< PHP代码开始>>
    

$image_html = ccImj_cropLandscape( $img_path, 300, 240 );

$ image_html = ccImj_cropLandscape($ img_path,300,240);

?>

?>

<< php code end >>

<< php代码结尾>>

ccImj_cropPortrait

ccImj_cropPortrait

– proportionally resize image to specified height, then crop excess width as required

–按比例将图像调整为指定的高度,然后根据需要裁剪多余的宽度

<< php code start >>
    

<< PHP代码开始>>
    

$image_html = ccImj_cropPortrait( $img_path, 300, 240, ‘class=”special-image-style” alt=”Your Blog”‘ );

$ image_html = ccImj_cropPortrait($ img_path,300,240,``class =” special-image-style” alt =“您的博客”');

?>

?>

<< php code end >>

<< php代码结尾>>

ccImj_cropSquareCtr

ccImj_cropSquareCtr

– resize image to specified size, then crop a square from the centre

–将图像调整为指定大小,然后从中心裁剪一个正方形

<< php code start >>
    

<< PHP代码开始>>
    

$image_html = ccImj_cropSquareCtr( $img_path, 60, ‘class=”special-image-style”‘ )

$ image_html = ccImj_cropSquareCtr($ img_path,60,``class =” special-image-style”')

<< php code end >>

<< php代码结尾>>

// ————————————————————————– ‘GET FIRST’ FUNCTIONS

// ————————————————————————“首先获取”功能

ccImj_firstLandscape

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 >>
    

<< PHP代码开始>>
    

ccImj_firstLandscape( $postContent, 480, TRUE, FALSE, ‘class=”special-image-style”‘ );

ccImj_firstLandscape($ postContent,480,TRUE,FALSE,'class =“ special-image-style”');

?>

?>

<< php code end >>

<< php代码结尾>>

ccImj_firstPortrait

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 >>
    

<< PHP代码开始>>
    

ccImj_firstPortrait( $postContent, 600, TRUE, FALSE, ‘class=”special-image-style”‘ );

ccImj_firstPortrait($ postContent,600,TRUE,FALSE,``class =“ special-image-style”');

?>

?>

<< php code end >>

<< php代码结尾>>

ccImj_firstThumb

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 >>
    

<< PHP代码开始>>
    

$image_html = ccImj_firstThumb( $content, 130, FALSE, TRUE, ‘class=”thumbnail-image-style”‘ );

$ image_html = ccImj_firstThumb($ content,130,FALSE,TRUE,‘class =“ thumbnail-image-style”‘);

?>

?>

<< php code end >>

<< php代码结尾>>

// ————————————————————————– RESIZE & CROP PASSED IMAGE FUNCTIONS

// ——————————————————————––调整并裁剪通过图像的功能

ccImj_linkedLandscape

ccImj_linkedLandscape

– resize image to specified width and height, then wrap it in a hyperlink if desired

–将图像调整为指定的宽度和高度,然后根据需要将其包装在超链接中

<< php code start >>
    

<< PHP代码开始>>
    

ccImj_linkedLandscape( $img_path, 600, 200, FALSE, FALSE, ‘class=”mega-banner”‘ );

ccImj_linkedLandscape($ img_path,600,200,FALSE,FALSE,'class =“ mega-banner”');

?>

?>

<< php code end >>

<< php代码结尾>>

ccImj_linkedPortrait

ccImj_linkedPortrait

– resize image to specified height and width, then wrap it in a hyperlink if desired

–将图像调整为指定的高度和宽度,然后根据需要将其包装在超链接中

<< php code start >>
    

<< PHP代码开始>>
    

$your_variable = ccImj_linkedPortrait( $img_path, 400, 180, TRUE, TRUE, ‘class=”thumbnail-image-style”‘ );

$ your_variable = ccImj_linkedPortrait($ img_path,400,180,TRUE,TRUE,‘class =“ thumbnail-image-style”’);

?>

?>

<< php code end >>

<< php代码结尾>>

ccImj_linkedThumb

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 >>
    

<< PHP代码开始>>
    

ccImj_linkedThumb( $img_path, 200, ‘http://www.workwithchoicecuts.com’, FALSE, ‘class=”thumbnail-image-style”‘ )

ccImj_linkedThumb($ img_path,200,‘http://www.workwithchoicecuts.com’,FALSE,‘class=“ thumbnail-image-style”’)

<< php code end >>

<< php代码结尾>>

// ————————————————————————– FILTER ALL FUNCTIONS

// ————————————————————————–过滤所有功能

ccImj_flexiWidth

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.

如果图像大于max_width调整大小并通过灯箱显示原始图像,或者小于min_width调整大小直至min_width。

** To use this function edit the constant ‘FILTER_FLEXI_WIDTH’ value to be TRUE.

**要使用此功能,请将常量“ FILTER_FLEXI_WIDTH”的值编辑为TRUE。

Find this at the top of the plugin code.

在插件代码的顶部找到它。

ccImj_allWidth

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.

**要使用此功能,请将常量“ FILTER_ALL_WIDTH”的值编辑为TRUE。

Find this at the top of the plugin code.

在插件代码的顶部找到它。

ccImj_allCrop

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.

**要使用此功能,请将常量“ FILTER_ALL_CROP”的值编辑为TRUE。

Find this at the top of the plugin code.

在插件代码的顶部找到它。

安装步骤

    1. Upload plugin-name.php to the /wp-content/plugins/ directory
    2. plugin-name.php 上载到 / wp-content / plugins / 目录

    3. Activate the plugin through the ‘Plugins’ menu in WordPress
    4. 通过WordPress中的“插件”菜单激活插件

    5. If you intend to use the integrated lightBox, place

    6. 如果要使用集成的lightBox,请放置 <?php wp_head();。

      ?> in your template header

    7. ?> 在模板标题中

    The PHP Thumbnail Library library requires a few particulars to work and to operate efficiently.

    PHP缩略图库库需要一些细节才能工作和有效运行。

    Please take the time to review the PHP Thumbnail Library documentation extracts below, or view the full documentation at http://phpthumb.gxdlabs.com/.

    请花些时间查看下面的PHP Thumbnail Library文档摘录,或访问http://phpthumb.gxdlabs.com/来查看完整的文档。

      • Server Config.

        服务器配置。

        Essentials

        基本要素

        The minimum requirements for the library to function as as follows:

        该库运行的最低要求如下:

          • PHP 5.2.x or greater
          • PHP 5.2.x或更高版本

          • GD 2.0 or greater
          • GD 2.0或更高版本

        • Performance Optimisation

          性能优化

          Working with images is a memory and CPU-intensive operation.

          使用图像是一项内存和CPU密集型操作。

          If you plan on working with large images (something taken in high quality on a recent digital camera), you’ll very likely need to increase PHP’s memory limit in your php.ini file.

          如果您打算使用大图像(最近用数码相机拍摄的高质量图像),则很可能需要增加php.ini文件中PHP的内存限制。

          Try at least half the available RAM on the server (within reason of course).

          请尝试服务器上至少一半的可用RAM(当然是由于一定原因)。

          Usually 128-256 MB works well for large images.

          通常,128-256 MB适用于大图像。

          While this may seem like a lot of memory, keep in mind that it will only be in use while resizing the images, and is freed up when manipulations complete.

          尽管这看起来可能会占用很多内存,但是请记住,只有在调整图像大小时才会使用它,并且在完成操作后将其释放。

        • Installing a caching plug-in is an advisable step if there is any posibility of your website receiving any sharp increase in traffic.

          如果您的网站可能会收到大量的流量增长,则建议您安装缓存插件。

          In fairness, it is a good idea to install a caching plug-in anyway.

          公平地说,最好还是安装一个缓存插件。

          Try WP-SuperCache which does a great job.

          尝试WP-SuperCache可以做得很好。

下载地址
https://downloads.wordpress.org/plugin/choicecuts-image-juggler.zip
-EOF-

AI助手支持GPT4.0