Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge branch 'release/1.6'

* release/1.6:
  Bump version to v1.6
  Change docblock of img(), removing 'alt' as an example of extra attributes to pass.
  Add examples of using namespacing with img() to readme
  Add default path key support to img()
  • Loading branch information...
commit 1cc4d6b1f882d490046280c2769e94e0958fe056 2 parents 5e1cb6f + d2dd9e4
Antony Male canton7 authored
2  bootstrap.php
@@ -4,7 +4,7 @@
4 4 * Casset: Convenient asset library for FuelPHP.
5 5 *
6 6 * @package Casset
7   - * @version v1.5
  7 + * @version v1.6
8 8 * @author Antony Male
9 9 * @license MIT License
10 10 * @copyright 2011 Antony Male
6 classes/casset.php
@@ -4,7 +4,7 @@
4 4 * Casset: Convenient asset library for FuelPHP.
5 5 *
6 6 * @package Casset
7   - * @version v1.5
  7 + * @version v1.6
8 8 * @author Antony Male
9 9 * @license MIT License
10 10 * @copyright 2011 Antony Male
@@ -677,7 +677,7 @@ public static function render_css_inline()
677 677 *
678 678 * @param mixed $images Image(s) to print. Can be string or array of strings
679 679 * @param string $alt The alternate text
680   - * @param array $attr Attributes to apply to each image (eg alt)
  680 + * @param array $attr Attributes to apply to each image (eg width)
681 681 * @return string The resulting <img> tag(s)
682 682 */
683 683 public static function img($images, $alt, $attr = array())
@@ -688,6 +688,8 @@ public static function img($images, $alt, $attr = array())
688 688 $ret = '';
689 689 foreach ($images as $image)
690 690 {
  691 + if (strpos($image, '::') === false)
  692 + $image = static::$default_path_key.'::'.$image;
691 693 $attr['src'] = static::$asset_url.static::find_file($image, 'img');
692 694 $ret .= html_tag('img', $attr);
693 695 }
2  classes/casset/csscompressor.php
@@ -17,7 +17,7 @@
17 17 * This library is used as part of Casset.
18 18 *
19 19 * @package Casset
20   - * @version v1.5
  20 + * @version v1.6
21 21 * @author Antony Male
22 22 * @license MIT License
23 23 * @link http://github.com/canton7/fuelphp-casset
2  classes/casset/cssurirewriter.php
@@ -10,7 +10,7 @@
10 10 * This library is used as part of Casset.
11 11 *
12 12 * @package Casset
13   - * @version v1.5
  13 + * @version v1.6
14 14 * @author Antony Male
15 15 * @license MIT License
16 16 * @link http://github.com/canton7/fuelphp-casset
2  classes/casset/jsmin.php
@@ -52,7 +52,7 @@
52 52 /**
53 53 * This library is used as part of Casset.
54 54 * @package Casset
55   - * @version v1.5
  55 + * @version v1.6
56 56 * @author Antony Male
57 57 * @license MIT License
58 58 * @link http://github.com/canton7/fuelphp-casset
2  config/casset.php
@@ -4,7 +4,7 @@
4 4 * Casset: Convenient asset library for FuelPHP.
5 5 *
6 6 * @package Casset
7   - * @version v1.5
  7 + * @version v1.6
8 8 * @author Antony Male
9 9 * @license MIT License
10 10 * @copyright 2011 Antony Male
6 readme.md
Source Rendered
@@ -292,6 +292,12 @@ Casset::js('core::index.js');
292 292
293 293 Casset::js('admin::index.js');
294 294 // Will add assets/admin/js/index.js
  295 +
  296 +echo Casset::img('test.png', 'An image');
  297 +// <img src="...assets/img/test.png" alt="An image" />
  298 +
  299 +echo Casset::img('admin::test.png', 'An image');
  300 +// <img src="...assets/admin/img/test.png" alt="An image" />
295 301 ```
296 302
297 303 If you wish, you can change the current default path key using `Casset::set_path('path_key')`. This can be useful if you know that all of the assets in a given file will be from a given path. For example:

0 comments on commit 1cc4d6b

Please sign in to comment.
Something went wrong with that request. Please try again.