2017 © Pedro Peláez
 

project asset

Simple asset helper to get asset (image, picture, stylesheet, script) elements or urls. Images and pictures have an option to resized and/or cropped dynamically.

image

crobays/asset

Simple asset helper to get asset (image, picture, stylesheet, script) elements or urls. Images and pictures have an option to resized and/or cropped dynamically.

  • Saturday, January 31, 2015
  • by crobays
  • Repository
  • 1 Watchers
  • 0 Stars
  • 19 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 18 Versions
  • 0 % Grown

The README.md

Crobays / Asset

Simple asset helper to get asset (image, picture, stylesheet, script) elements or urls. Images and pictures have an option to resized and/or cropped dynamically., (*1)

Require

"crobays/asset": "dev-master"

Usage

php artisan config:publish crobays/asset creates a config file in your Lavavel project: app/packages/crobays/asset/config.php, (*2)

Images

Asset::img('my-image.png', ['w' => 400])

grabs images/my-image.png to fit width 400px, saves it to img/my-image___w400.png (also create a @2x version for hi-dpi displays, you need to include retina.js to use this functionality) and returns, (*3)

<img width="400" src="//assets.example.com/img/my-image___w400.png" 
    data-src2x="//assets.example.com/img/my-image___w400-@2x.png">

Resize and crop the image by providing both width and height, (*4)

Asset::img('my-image.png', ['w' => 250, 'h' => 250])

grabs images/my-image.png to fit width 250px and height 250px, saves it to img/my-image___w250-h250.png and returns, (*5)

<img width="250" height="250" src="//assets.example.com/img/my-image___w250-h250.png" 
    data-src2x="//assets.example.com/img/my-image___w250-h250-@2x.png">

Provide a size (sizes defined in app/packages/crobays/asset/config.php), (*6)

Asset::img('my-image.png', ['s' => 'xlarge'])

makes image and returns, (*7)

<img width="960" src="//assets.example.com/img/my-image___w960.png" 
    data-src2x="//assets.example.com/img/my-image___w960-@2x.png">

Provide a special 100% size (defined in the app/packages/crobays/asset/config.php), (*8)

Asset::img('my-image.png', ['s' => '100%'])

makes image and returns, (*9)

<img width="100%" src="//assets.example.com/img/my-image___w800.png" 
    data-src2x="//assets.example.com/img/my-image___w800-@2x.png">

It allows you to add custom HTML attributes, (*10)

Asset::img('my-image.png', ['w' => 300, 'class' => 'image'])

makes image and returns, (*11)

<img width="250" class="image" src="//assets.example.com/img/my-image___w300.png" 
    data-src2x="//assets.example.com/img/my-image___w300-@2x.png">

Pictures

Asset::pic('picture.jpg', ['w' => 1440])

grabs pictures/picture.jpg to fit width 1440px, saves it to pictures/picture___w1440.jpg (also create a @2x version for hi-dpi displays, you need to include retina.js to use this functionality) and returns, (*12)

<img width="1440" src="//assets.example.com/pic/picture___w1440.jpg" 
    data-src2x="//assets.example.com/pic/picture___w1440-@2x.jpg">

(Inherits also all image functionalty found above), (*13)


CSS

(default stylesheet defined in the app/packages/crobays/asset/config.php), (*14)

Asset::css()
Asset::css('another-style.css')

returns, (*15)

<link type="text/css" href="//assets.example.com/style.css" rel="stylesheet">
<link type="text/css" href="//assets.example.com/another-style.css" rel="stylesheet">

Javascript

(default script defined in the app/packages/crobays/asset/config.php), (*16)

Asset::js()
Asset::js('another-script.js')

returns, (*17)

<script type="text/javascript" src="//assets.example.com/script.js"></script>
<script type="text/javascript" src="//assets.example.com/another-script.js"></script>

Todo

  • phpspec tests
  • codeception tests
  • comment block documentation

The Versions

31/01 2015

dev-dev

dev-dev

Simple asset helper to get asset (image, picture, stylesheet, script) elements or urls. Images and pictures have an option to resized and/or cropped dynamically.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Maikel Vlasman

laravel web

25/01 2015

dev-master

9999999-dev

Simple asset helper to get asset (image, picture, stylesheet, script) elements or urls. Images and pictures have an option to resized and/or cropped dynamically.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Maikel Vlasman

laravel web

17/01 2015

0.9.9

0.9.9.0

Simple asset helper to get asset (image, picture, stylesheet, script) elements or urls. Images and pictures have an option to resized and/or cropped dynamically.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Maikel Vlasman

laravel web

17/01 2015

dev-feature-custom-img-attr

dev-feature-custom-img-attr

Simple asset helper to get asset (image, picture, stylesheet, script) elements or urls. Images and pictures have an option to resized and/or cropped dynamically.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Maikel Vlasman

laravel web

18/12 2014

dev-hotfix-path-fix

dev-hotfix-path-fix

Simple asset helper to get asset (image, picture, stylesheet, script) elements or urls. Images and pictures have an option to resized and/or cropped dynamically.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Maikel Vlasman

laravel web

18/12 2014

0.9.8

0.9.8.0

Simple asset helper to get asset (image, picture, stylesheet, script) elements or urls. Images and pictures have an option to resized and/or cropped dynamically.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Maikel Vlasman

laravel web

01/12 2014

dev-release-0.9

dev-release-0.9

Simple asset helper to get asset (image, picture, stylesheet, script) elements or urls. Images and pictures have an option to resized and/or cropped dynamically.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Maikel Vlasman

laravel web

01/12 2014

0.9.7

0.9.7.0

Simple asset helper to get asset (image, picture, stylesheet, script) elements or urls. Images and pictures have an option to resized and/or cropped dynamically.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Maikel Vlasman

laravel web

17/11 2014

dev-feature-img-src2x

dev-feature-img-src2x

Simple asset query call to get images-, pictures-, file-, stylesheets- and script links.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Maikel Vlasman

laravel web

15/11 2014

0.9.6

0.9.6.0

Simple asset query call to get images-, pictures-, file-, stylesheets- and script links.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Maikel Vlasman

laravel web

15/11 2014

dev-hotfix-command-root-path

dev-hotfix-command-root-path

Simple asset query call to get images-, pictures-, file-, stylesheets- and script links.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Maikel Vlasman

laravel web

12/11 2014

0.9.5

0.9.5.0

Simple asset query call to get images-, pictures-, file-, stylesheets- and script links.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Maikel Vlasman

laravel web

12/11 2014

0.9.4

0.9.4.0

Simple asset query call to get images-, pictures-, file-, stylesheets- and script links.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Maikel Vlasman

laravel web

12/11 2014

dev-feature-read-out-css-file

dev-feature-read-out-css-file

Simple asset query call to get images-, pictures-, file-, stylesheets- and script links.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Maikel Vlasman

laravel web

07/11 2014

dev-feature-refactor

dev-feature-refactor

Simple asset query call to get images-, pictures-, file-, stylesheets- and script links.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Maikel Vlasman

laravel web

07/11 2014

0.9.3

0.9.3.0

Simple asset query call to get images-, pictures-, file-, stylesheets- and script links.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Maikel Vlasman

laravel web

29/10 2014

0.9.1

0.9.1.0

Simple asset query call to get images-, pictures-, stylesheets- and script links.

  Sources   Download

MIT

The Requires

 

by Maikel Vlasman

laravel web

29/10 2014

0.9.0

0.9.0.0

Simple asset query call to get images-, pictures-, stylesheets- and script links.

  Sources   Download

MIT

The Requires

 

by Maikel Vlasman

laravel web