Linux 软件免费装

Klan1 Common WP Functions

开发者 k1-j0hnd03
更新时间 2015年8月13日 01:26
捐献地址: 去捐款
PHP版本: 2.7 及以上
WordPress版本: 4.2.4
版权: GPLv2 or later
版权网址: 版权信息

标签

developer klan1 basic functions image resize

下载

详情介绍:

This functions are for those needs to resize images on their templates or plugins all the time. FUNCTION: k1_get_post_thumb_url DESCRIPTION string k1_get_post_thumb_url(int $post_id) This function return the URL for the FEATURED IMAGE (full sized) defined in a POST/PAGE even if the upload is no on the actual post. If is not defined returns the FIRST image if there is at least one. Returns NULL if no jpg,png or gif images as attachments. USAGE EXAMPLE <?php echo k1_get_post_thumb_url($post_id); ?> PARAMETERS FUNCTION: k1_get_post_timthumb_img_url DESCRIPTION string k1_get_post_timthumb_img_url(int $post_id, int $width, int $height, int $crop, char $align, int $quality) Returns the IMAGE full URL using timthumb script to resize the post featured image. Use this when you only need the URL not the IMG html tag. USAGE EXAMPLE <?php echo k1_get_post_timthumb_img_url(null, 80, 50, 1, "t", 50); ?> PARAMETERS NOTE: If you just define one height or width as zero (0) the other one will conserve image proportion, if is not defined it will be default value. FUNCTION: k1_get_post_thumb_img_html DESCRIPTION string k1_get_post_thumb_img_html(int $post_id, boolean $resize, int $width, int $height, int $crop, char $align, int $quality) This function returns the FULL IMG HTML tag for the post featured image using TIMTHUMB or not as desired USAGE EXAMPLE <?php echo k1_get_post_thumb_img_html(null, true, 80, 50, 1, "t", 50); ?> PARAMETERS NOTE: If you just define one height or width as zero (0) the other one will conserve image proportion, if is not defined it will be default value. TODO:

安装:

  1. Upload k1-functions directory to the /wp-content/plugins/ directory
  2. Activate the plugin through the 'Plugins' menu in WordPress
  3. All ready

常见问题:

Have some configuration file?

No, are just functions for developers and coders, see k1-functions.php to get more info. For TIMTHUMB see: http://www.binarymoon.co.uk/2012/03/timthumb-configs/. But, it supposed to work as is now.

images are not displayed !

Normally is permission problems. Please try 766 permissions on {wordpress plugins path}/k1-functions/tools/timthumb/cache. There will be the "small" copy of every img resized by this function. If not, Left click on the img, COPY the URL and see the error on the browser, probably you will know what to do. The FOLDER "cache" must have write access any way.

更新日志:

0.5 0.4 0.3.9 0.3.7 0.3 0.2 0.1.1 Better coding and comments. 0.1 First relase "as is".