Title: Klan1 Common WP Functions
Author: Alejandro Trujillo J.
Published: <strong>2013-11-12</strong>
Last modified: 2015-08-12

---

Szukaj wtyczek

Wtyczka **nie została przetestowana z trzema ostatnimi głównymi wydaniami WordPressa**.
Może nie być już utrzymywana lub obsługiwana, co może skutkować problemem ze zgodnością
z nowszymi wersjami WordPressa.

![](https://s.w.org/plugins/geopattern-icon/klan1-functions.svg)

# Klan1 Common WP Functions

 Autor: [Alejandro Trujillo J.](https://profiles.wordpress.org/k1-j0hnd03/)

[Pobierz](https://downloads.wordpress.org/plugin/klan1-functions.zip)

 * [Szczegóły](https://pl.wordpress.org/plugins/klan1-functions/#description)
 * [Recenzje](https://pl.wordpress.org/plugins/klan1-functions/#reviews)
 *  [Instalacja](https://pl.wordpress.org/plugins/klan1-functions/#installation)
 * [Rozwój](https://pl.wordpress.org/plugins/klan1-functions/#developers)

 [Wsparcie](https://wordpress.org/support/plugin/klan1-functions/)

## Opis

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

 * **`$post_id`** If is empty, we will try to get the POST ID from the global $post
   var

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

 * **`$post_id`** If is empty, we will try to get the POST ID from the global $post
   var
 * **`$width`** This is numeric in pixels, if you use 0 width will be proportional
   to height. See: http://www.binarymoon.co.uk/demo/timthumb-basic/
 * **`$height`** This is numeric in pixels, if you use 0 height will be proportional
   to height. See: http://www.binarymoon.co.uk/demo/timthumb-basic/
 * **`$crop`** Use: **0** Resize to Fit specified dimensions (no cropping), **1**
   Crop and resize to best fit the dimensions (default), **2** Resize proportionally
   to fit entire image into specified dimensions, and add borders if required, **
   3** Resize proportionally adjusting size of scaled image so there are no borders
   gaps, see: http://www.binarymoon.co.uk/demo/timthumb-zoom-crop/
 * **`$align`** **c** : position in the center (this is the default), **t** : align
   top, **tr** : align top right, **tl** : align top left, **b** : align bottom,**
   br** : align bottom right, **bl** : align bottom left, **l** : align left, **
   r** : align rightSee: http://www.binarymoon.co.uk/2010/08/timthumb-part-4-moving-
   crop-location/
 * **`$quality`** **70** : Image quality from the original uploaded image in percentage

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

 * **`$post_id`** If is empty, we will try to get the POST ID from the global $post
   var
 * **`$resize`** TRUE to use timthumb script to resize the image, FALSE to return
   the image without any dimension change.
 * **`$width`** This is numeric in pixels, if you use 0 width will be proportional
   to height. See: http://www.binarymoon.co.uk/demo/timthumb-basic/
 * **`$height`** This is numeric in pixels, if you use 0 height will be proportional
   to height. See: http://www.binarymoon.co.uk/demo/timthumb-basic/
 * **`$crop`** Use: **0** Resize to Fit specified dimensions (no cropping), **1**
   Crop and resize to best fit the dimensions (default), **2** Resize proportionally
   to fit entire image into specified dimensions, and add borders if required, **
   3** Resize proportionally adjusting size of scaled image so there are no borders
   gaps, see: http://www.binarymoon.co.uk/demo/timthumb-zoom-crop/
 * **`$align`** **c** : position in the center (this is the default), **t** : align
   top, **tr** : align top right, **tl** : align top left, **b** : align bottom,**
   br** : align bottom right, **bl** : align bottom left, **l** : align left, **
   r** : align rightSee: http://www.binarymoon.co.uk/2010/08/timthumb-part-4-moving-
   crop-location/
 * **`$quality`** **70** : Image quality from the original uploaded image in percentage

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

 * Get the attachment metadata to make the longdesc=”” and alt=”” IMG properties.
 * Use the parameters as array to implement more options

## Instalacja

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

## Najczęściej zadawane pytania

  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.

## Recenzje

Wtyczka nie ma jeszcze żadnej recenzji.

## Kontrybutorzy i deweloperzy

„Klan1 Common WP Functions” jest oprogramowaniem open source. Poniższe osoby miały
wkład w rozwój wtyczki.

Zaangażowani

 *   [ Alejandro Trujillo J. ](https://profiles.wordpress.org/k1-j0hnd03/)

[Przetłumacz wtyczkę “Klan1 Common WP Functions” na swój język.](https://translate.wordpress.org/projects/wp-plugins/klan1-functions)

### Interesuje cię rozwój wtyczki?

[Przeglądaj kod](https://plugins.trac.wordpress.org/browser/klan1-functions/), sprawdź
[repozytorium SVN](https://plugins.svn.wordpress.org/klan1-functions/) lub czytaj
[dziennik rozwoju](https://plugins.trac.wordpress.org/log/klan1-functions/) przez
[RSS](https://plugins.trac.wordpress.org/log/klan1-functions/?limit=100&mode=stop_on_copy&format=rss).

## Rejestr zmian

#### 0.5

 * 70% quality by default and now can be set by developer on function call with 
   a parameter.
 * now the featured image can be used from another post, in < 0.4 everyone has to
   upload de image on the post by force
 * Readme.txt changed for better use understanding

#### 0.4

 * 100% quality on thumb generation, was 60% before.
 * Readme.txt changed for better use understanding

#### 0.3.9

 * Various code fixes.
 * removed url encoded get parameters

#### 0.3.7

 * Various code fixes.
 * url encoded get parameters

#### 0.3

 * Various code fixes.
 * TimThumb allow external images

#### 0.2

 * Various code fixes.
 * Better coding and comments.

#### 0.1.1

Better coding and comments.

#### 0.1

First relase „as is”.

## Meta

 *  Wersja **0.5**
 *  Ostatnia aktualizacja **11 lat temu**
 *  Włączone instalacje **10+**
 *  Wersja WordPressa ** 2.7 lub nowszej **
 *  Testowano do **4.2.39**
 *  Język
 * [English (US)](https://wordpress.org/plugins/klan1-functions/)
 * Tagi
 * [developer](https://pl.wordpress.org/plugins/tags/developer/)[image resize](https://pl.wordpress.org/plugins/tags/image-resize/)
   [klan1](https://pl.wordpress.org/plugins/tags/klan1/)
 *  [Widok zaawansowany](https://pl.wordpress.org/plugins/klan1-functions/advanced/)

## Oceny

Nie przesłano jeszcze żadnych recenzji.

[Your review](https://wordpress.org/support/plugin/klan1-functions/reviews/#new-post)

[Zobacz wszystkierecenzje.](https://wordpress.org/support/plugin/klan1-functions/reviews/)

## Zaangażowani

 *   [ Alejandro Trujillo J. ](https://profiles.wordpress.org/k1-j0hnd03/)

## Wsparcie

Masz coś do dodania? Potrzebujesz pomocy?

 [Zobacz forum wsparcia](https://wordpress.org/support/plugin/klan1-functions/)

## Złóż datek

Czy chcesz wesprzeć rozwój wtyczki?

 [ Wspomóż wtyczkę ](http://klan1.com/)