De Lab - Darío Ferrer
Este artículo tiene una versión en español: WPSI II - Tabla de Parámetros
Overview
With WP Smart Image II you'll find very easy setting the images shown in your website. The parameter's sintax is the same than comes natively with Wordpress. You can combine the different parameters/values on this way:
<?php wpsi('param1=value¶m2=value¶m3=value') ?>
You can sort the parameters as you wish, assigning the the corresponding values.
Types of parameters
WP Smart Image II te ayuda a configurar imágenes y enlaces de un solo golpe, por lo cual existen parámetros exclusivos para cada elemento, así como parámetros globales o comunes:
WP Smart Image II helps you to set images and links in a while, so there are different types of parameters for each element, as well as global parameters, and common parameters:
- Common parameters: Modify all the function.
- Image parameters: Only modify images.
- Link parameters: Only modify links.
To know the default values, can revise this article: WPSI II - Default values
Parameters table
| Common parameters | ||
|---|---|---|
| Parameter | Value | Behavior |
| showtitle |
|
Enables/disables the
Default: 1. |
|
Example: <?php wpsi('showtitle=img') ?>
|
||
|
[ Top ] Common parameters: showtitle, quotes and array Image parameters: size, type, wh, class, cid, element, alt, title and custom Link parameters: aclass, aid, rel, atitle, target, targetname, acustom and ref |
||
| Parameter | Value | Behavior |
| quotes |
|
Toggles all attribute quotes between singles or doubles:
Default: null. |
|
Example: <?php wpsi('quotes=single') ?>
Result: <a title='titulo enlace' href='http://website.com/path-to/article.html'><img src='http://website.com/path-to/image-1.jpg' alt='texto alt' title='titulo img' /></a> |
||
|
[ Top ] Common parameters: showtitle, quotes and array Image parameters: size, type, wh, class, cid, element, alt, title and custom Link parameters: aclass, aid, rel, atitle, target, targetname, acustom and ref |
||
| Parameter | Value | Behavior |
| array |
|
Returns the result as an array. Specially useful when the Nota: the Default: 0. |
|
Example 1: <?php
$var = get_wpsi('array=1&number=-1&type=single');
print_r($var);
?>
Result: Array ( [0] => <img src="http://website.com/path-to/image-1.jpg" alt="some alt 1" title="some title 1" /> [1] => <img src="http://website.com/path-to/image-2.jpg" alt="some alt 2" title="some title 2" /> [2] => <img src="http://website.com/path-to/image-3.jpg" alt="some alt 3" title="some title 3" /> ) Example 2 [ Notice we are using <?php
$var = get_wpsi('array=1&number=-1&type=single');
foreach($var as $v) {
echo '<div class="someclass">'. $v .'</div>';
}
?>
Result: <div class="someclass"><img src="http://website.com/path-to/image-1.jpg" /></div> <div class="someclass"><img src="http://website.com/path-to/image-2.jpg" /></div> <div class="someclass"><img src="http://website.com/path-to/image-3.jpg" /></div> Example 3. Lets try something a little more complex: We'll construct a kind of gallery taking the <?php
$var = get_wpsi('array=1&number=-1&type=url');
$var[] = get_wpsi('array=1&number=-1&element=title');
$var[] = get_wpsi('array=1&number=-1&element=alt');
foreach($var as $v) {
echo '
<div class="someclass" style="background: url('. $v[0] .');">
<h3>'. $v[1] .'</h3>
<p>'. $v[2] .'</p>
</div>';
}
?>
Result: <div class="someclass" style="background: url(http://website.com/path-to/image-1.jpg);"> <h3>Image Title 1</h3> <p>Alternate text of the image 1</p> </div> <div class="someclass" style="background: url(http://website.com/path-to/image-2.jpg);"> <h3>Image Title 2</h3> <p>Alternate text of the image 2</p> </div> <div class="someclass" style="background: url(http://website.com/path-to/image-3.jpg);"> <h3>Image Title 3</h3> <p>Alternate text of the image 3</p> </div> |
||
|
[ Top ] Common parameters: showtitle, quotes and array Image parameters: size, type, wh, class, cid, element, alt, title and custom Link parameters: aclass, aid, rel, atitle, target, targetname, acustom and ref |
||
| Image parameters | ||
| Parameter | Value | Behavior |
| size |
|
Sets the image size:
Default: mini |
|
Example: <?php wpsi('size=med') ?>
Example usando Max Image Size Control plugin: <?php wpsi('size=custom0') ?>
|
||
|
[ Top ] Common parameters: showtitle, quotes and array Image parameters: size, type, wh, class, cid, element, alt, title and custom Link parameters: aclass, aid, rel, atitle, target, targetname, acustom and ref |
||
| Parameter | Value | Behavior |
| type |
|
How you want to get the image :
Default: link |
|
Example: <?php wpsi('type=url') ?>
|
||
|
[ Top ] Common parameters: showtitle, quotes and array Image parameters: size, type, wh, class, cid, element, alt, title and custom Link parameters: aclass, aid, rel, atitle, target, targetname, acustom and ref |
||
| Parameter | Value | Behavior |
| wh |
|
Adds width/height attributes to the image . Supposing the image has 100px X 100px:
Default: null |
|
Example: <?php wpsi('wh=css') ?>
|
||
|
[ Top ] Common parameters: showtitle, quotes and array Image parameters: size, type, wh, class, cid, element, alt, title and custom Link parameters: aclass, aid, rel, atitle, target, targetname, acustom and ref |
||
| Parameter | Value | Behavior |
| class | [Any value] |
Allows to add CSS classes to the image. Default: null |
|
Example: <?php wpsi('class=foo') ?>
|
||
|
[ Top ] Common parameters: showtitle, quotes and array Image parameters: size, type, wh, class, cid, element, alt, title and custom Link parameters: aclass, aid, rel, atitle, target, targetname, acustom and ref |
||
| Parameter | Value | Behavior |
| cid | [Any value] |
Allows to add an ID to the image. Default: null |
|
Example: <?php wpsi('cid=bar') ?>
|
||
|
[ Top ] Common parameters: showtitle, quotes and array Image parameters: size, type, wh, class, cid, element, alt, title and custom Link parameters: aclass, aid, rel, atitle, target, targetname, acustom and ref |
||
| Parameter | Value | Behavior |
| element |
|
This parameter allows you to literally cutting the image in pieces, so you can show each one separately.
Default: null
|
|
Example: <?php wpsi('element=mimetype') ?>
Supposing the image is a PNG file, te above code will show "image/png" |
||
|
[ Top ] Common parameters: showtitle, quotes and array Image parameters: size, type, wh, class, cid, element, alt, title and custom Link parameters: aclass, aid, rel, atitle, target, targetname, acustom and ref |
||
| Parameter | Value | Behavior |
| alt |
|
Defines the
Default: Note: In case of default (generic) images, WPSI will take the predefined |
|
Example 1: <?php wpsi('alt=Hello Dolly') ?>
Example 2: <?php wpsi('alt=el_title') ?>
Example 3: <?php wpsi('alt=el_alt') ?>
Example 4: <?php wpsi('alt=Imagen de el_title') ?>
Example 5: <?php wpsi('alt=Imagen de el_alt') ?>
|
||
|
[ Top ] Common parameters: showtitle, quotes and array Image parameters: size, type, wh, class, cid, element, alt, title and custom Link parameters: aclass, aid, rel, atitle, target, targetname, acustom and ref |
||
| Parameter | Value | Behavior |
| title |
|
Defines the
Default: Note: In case of default (generic) images, WPSI will take the predefined |
|
Example 1: <?php wpsi('title=Hello Dolly') ?>
Example 2: <?php wpsi('title=el_title') ?>
Example 3: <?php wpsi('title=el_alt') ?>
Example 4: <?php wpsi('title=Imagen de el_title') ?>
Example 5: <?php wpsi('title=Imagen de el_alt') ?>
|
||
|
[ Top ] Common parameters: showtitle, quotes and array Image parameters: size, type, wh, class, cid, element, alt, title and custom Link parameters: aclass, aid, rel, atitle, target, targetname, acustom and ref |
||
| Parameter | Value | Behavior |
| custom |
|
Allows to add custom attributes to the image. The
You can add many attributes as you wish. Default: null. |
|
Example 1: <?php wpsi('custom=myAttribute,my-value|anotherAttr,another-value') ?>
Result: [...] myAttribute="my-value" anotherAttr="another-value" [...] Example 2: <?php wpsi('custom=myAttribute,my-value-'. get_the_ID() .'|anotherAttr,'. get_the_title()) ?>
Result: [...] myAttribute="my-value-123" anotherAttr="Post/Page Title" [...] |
||
|
[ Top ] Common parameters: showtitle, quotes and array Image parameters: size, type, wh, class, cid, element, alt, title and custom Link parameters: aclass, aid, rel, atitle, target, targetname, acustom and ref |
||
| Parámetros del enlace | ||
| Parameter | Value | Behavior |
| aclass | [Any value] |
Allows to add CSS classes to the link. Default: null |
|
Example: <?php wpsi('aclass=foo') ?>
|
||
|
[ Top ] Common parameters: showtitle, quotes and array Image parameters: size, type, wh, class, cid, element, alt, title and custom Link parameters: aclass, aid, rel, atitle, target, targetname, acustom and ref |
||
| Parameter | Value | Behavior |
| aid | [Any value] |
Allows to add an ID to the link. Default: null |
|
Example: <?php wpsi('aid=bar') ?>
|
||
|
[ Top ] Common parameters: showtitle, quotes and array Image parameters: size, type, wh, class, cid, element, alt, title and custom Link parameters: aclass, aid, rel, atitle, target, targetname, acustom and ref |
||
| Parameter | Value | Behavior |
| rel | [Any value] |
Allows to add a Default: null |
|
Example: <?php wpsi('rel=foo') ?>
|
||
|
[ Top ] Common parameters: showtitle, quotes and array Image parameters: size, type, wh, class, cid, element, alt, title and custom Link parameters: aclass, aid, rel, atitle, target, targetname, acustom and ref |
||
| Parameter | Value | Behavior |
| atitle |
|
Defines the
Default: null. Note: In case of default (generic) images, WPSI will take the predefined |
|
Example 1: <?php wpsi('atitle=el_title') ?>
Example 2: <?php wpsi('atitle=Seguir leyendo el_title') ?>
Example 3: <?php wpsi('atitle=Hello Dolly') ?>
|
||
|
[ Top ] Common parameters: showtitle, quotes and array Image parameters: size, type, wh, class, cid, element, alt, title and custom Link parameters: aclass, aid, rel, atitle, target, targetname, acustom and ref |
||
| Parameter | Value | Behavior |
| target |
|
Adds the
Default: null |
|
Example: <?php wpsi('target=blank') ?>
|
||
|
[ Top ] Common parameters: showtitle, quotes and array Image parameters: size, type, wh, class, cid, element, alt, title and custom Link parameters: aclass, aid, rel, atitle, target, targetname, acustom and ref |
||
| Parameter | Value | Behavior |
| targetname |
|
Adds the
Default: null |
|
Example: <?php wpsi('targetname=foobar') ?>
|
||
|
[ Top ] Common parameters: showtitle, quotes and array Image parameters: size, type, wh, class, cid, element, alt, title and custom Link parameters: aclass, aid, rel, atitle, target, targetname, acustom and ref |
||
| Parameter | Value | Behavior |
| acustom |
|
Adds custom attributes to the link. The
You can add many attributes as you wish. Default: null. |
|
Example: <?php wpsi('custom=onclick,javascript('something')|onmouseover,this.anotherThing()') ?>
Result: [...] onclick="javascript('something')" onmouseover="this.anotherThing()" [...]
|
||
|
[ Top ] Common parameters: showtitle, quotes and array Image parameters: size, type, wh, class, cid, element, alt, title and custom Link parameters: aclass, aid, rel, atitle, target, targetname, acustom and ref |
||
| Parameter | Value | Behavior |
| ref |
|
Adds a referer to the link, so the programmer will be able to handle its behavior through the
Default: null |
|
Example: <?php wpsi('ref=module') ?>
Result (Watch the URL structure): <a title='Link title' href='http://website.com/path-to/article.html?ref=module'><img src='http://website.com/path-to/image-1.jpg' alt='Image alt' title='Image title' /></a> |
||
|
[ Top ] Common parameters: showtitle, quotes and array Image parameters: size, type, wh, class, cid, element, alt, title and custom Link parameters: aclass, aid, rel, atitle, target, targetname, acustom and ref |
||
