Yii 1.1: imgresizer

This widget use URL-based API of imgurl.com
4 followers

This widget uses URL-based API for process images. There are many commands:

  • Resize
  • Scale
  • Width
  • Height
  • Fit
  • Thumbnail
  • Square
  • Rotate
  • Crop
  • Watermark
  • Black & White
  • Invert
  • Blur
  • Sharpen
  • Convert

Requirements

Yii 1.1 or above (tested on 1.1.8)

Painful things

The webservice urlimg.com is completely free to use up to the first 50 MB of processed images stored.

Resize

<?php $this->widget('ext.imgresizer.ImgResizer', array(
    'imageUrl' => 'http://www.yiiframework.com/files/logo/yii.png',
    'command' => 'resize',
    'width' => '66',
    'height' => '66'
)); ?>

Scale

<?php $this->widget('ext.imgresizer.ImgResizer', array(
    'imageUrl' => 'http://www.yiiframework.com/files/logo/yii.png',
    'command' => 'scale',
    'percent' => '66',
)); ?>

Width

<?php $this->widget('ext.imgresizer.ImgResizer', array(
    'imageUrl' => 'http://www.yiiframework.com/files/logo/yii.png',
    'command' => 'width',
    'size' => '66',
)); ?>

Height

<?php $this->widget('ext.imgresizer.ImgResizer', array(
    'imageUrl' => 'http://www.yiiframework.com/files/logo/yii.png',
    'command' => 'hright',
    'size' => '66',
)); ?>

Fit

<?php $this->widget('ext.imgresizer.ImgResizer', array(
    'imageUrl' => 'http://www.yiiframework.com/files/logo/yii.png',
    'command' => 'fit',
    'width' => '66',
    'height' => '66',
)); ?>

Thumbnail

<?php $this->widget('ext.imgresizer.ImgResizer', array(
    'imageUrl' => 'http://www.yiiframework.com/files/logo/yii.png',
    'command' => 'thumbnail',
    'size' => '66',
)); ?>

Square

<?php $this->widget('ext.imgresizer.ImgResizer', array(
    'imageUrl' => 'http://www.yiiframework.com/files/logo/yii.png',
    'command' => 'square',
    'size' => '66',
)); ?>

Crop

<?php $this->widget('ext.imgresizer.ImgResizer', array(
    'imageUrl' => 'http://www.yiiframework.com/files/logo/yii.png',
    'command' => 'crop',
    'cornerx' => '66',
    'cornery' => '66',
    'width' => '66',
    'height' => '66'
)); ?>

Watermark

<?php $this->widget('ext.imgresizer.ImgResizer', array(
    'imageUrl' => 'http://www.yiiframework.com/files/logo/yii.png',
    'command' => 'wm',
    'text' => 'Some text'
)); ?>

Black & White

<?php $this->widget('ext.imgresizer.ImgResizer', array(
    'imageUrl' => 'http://www.yiiframework.com/files/logo/yii.png',
    'command' => 'bw'
)); ?>

Invert

<?php $this->widget('ext.imgresizer.ImgResizer', array(
    'imageUrl' => 'http://www.yiiframework.com/files/logo/yii.png',
    'command' => 'invert'
)); ?>

Blur

<?php $this->widget('ext.imgresizer.ImgResizer', array(
    'imageUrl' => 'http://www.yiiframework.com/files/logo/yii.png',
    'command' => 'blur'
)); ?>

Sharpen

<?php $this->widget('ext.imgresizer.ImgResizer', array(
    'imageUrl' => 'http://www.yiiframework.com/files/logo/yii.png',
    'command' => 'sharpen'
)); ?>

Convert

<?php $this->widget('ext.imgresizer.ImgResizer', array(
    'imageUrl' => 'http://www.yiiframework.com/files/logo/yii.png',
    'command' => 'convert',
    'format' => 'gif'
)); ?>

Total 1 comment

#5326 report it
sensorario at 2011/10/04 09:46pm
Dont user this widget in production!!!

The webservice urlimg.com is completely free to use up to the first 50 MB of processed images stored. If someone know a webservice with no limit, I'll update this extension.

Leave a comment

Please to leave your comment.

Create extension