Browse files

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...
2 parents 5e1cb6f + d2dd9e4 commit 1cc4d6b1f882d490046280c2769e94e0958fe056 @canton7 canton7 committed Jun 19, 2011
Showing with 15 additions and 7 deletions.
  1. +1 −1 bootstrap.php
  2. +4 −2 classes/casset.php
  3. +1 −1 classes/casset/csscompressor.php
  4. +1 −1 classes/casset/cssurirewriter.php
  5. +1 −1 classes/casset/jsmin.php
  6. +1 −1 config/casset.php
  7. +6 −0 readme.md
View
2 bootstrap.php
@@ -4,7 +4,7 @@
* Casset: Convenient asset library for FuelPHP.
*
* @package Casset
- * @version v1.5
+ * @version v1.6
* @author Antony Male
* @license MIT License
* @copyright 2011 Antony Male
View
6 classes/casset.php
@@ -4,7 +4,7 @@
* Casset: Convenient asset library for FuelPHP.
*
* @package Casset
- * @version v1.5
+ * @version v1.6
* @author Antony Male
* @license MIT License
* @copyright 2011 Antony Male
@@ -677,7 +677,7 @@ public static function render_css_inline()
*
* @param mixed $images Image(s) to print. Can be string or array of strings
* @param string $alt The alternate text
- * @param array $attr Attributes to apply to each image (eg alt)
+ * @param array $attr Attributes to apply to each image (eg width)
* @return string The resulting <img> tag(s)
*/
public static function img($images, $alt, $attr = array())
@@ -688,6 +688,8 @@ public static function img($images, $alt, $attr = array())
$ret = '';
foreach ($images as $image)
{
+ if (strpos($image, '::') === false)
+ $image = static::$default_path_key.'::'.$image;
$attr['src'] = static::$asset_url.static::find_file($image, 'img');
$ret .= html_tag('img', $attr);
}
View
2 classes/casset/csscompressor.php
@@ -17,7 +17,7 @@
* This library is used as part of Casset.
*
* @package Casset
- * @version v1.5
+ * @version v1.6
* @author Antony Male
* @license MIT License
* @link http://github.com/canton7/fuelphp-casset
View
2 classes/casset/cssurirewriter.php
@@ -10,7 +10,7 @@
* This library is used as part of Casset.
*
* @package Casset
- * @version v1.5
+ * @version v1.6
* @author Antony Male
* @license MIT License
* @link http://github.com/canton7/fuelphp-casset
View
2 classes/casset/jsmin.php
@@ -52,7 +52,7 @@
/**
* This library is used as part of Casset.
* @package Casset
- * @version v1.5
+ * @version v1.6
* @author Antony Male
* @license MIT License
* @link http://github.com/canton7/fuelphp-casset
View
2 config/casset.php
@@ -4,7 +4,7 @@
* Casset: Convenient asset library for FuelPHP.
*
* @package Casset
- * @version v1.5
+ * @version v1.6
* @author Antony Male
* @license MIT License
* @copyright 2011 Antony Male
View
6 readme.md
@@ -292,6 +292,12 @@ Casset::js('core::index.js');
Casset::js('admin::index.js');
// Will add assets/admin/js/index.js
+
+echo Casset::img('test.png', 'An image');
+// <img src="...assets/img/test.png" alt="An image" />
+
+echo Casset::img('admin::test.png', 'An image');
+// <img src="...assets/admin/img/test.png" alt="An image" />
```
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.