Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
denysdesign committed Jan 16, 2021
1 parent 666091b commit d62c204
Showing 1 changed file with 14 additions and 19 deletions.
33 changes: 14 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ Create thumbs for Joomla! extension or stand-alone use.
* [Sci314.com](https://sci314.com)
* [Львівська міська рада](http://city-adm.lviv.ua)
* [Високий замок](https://wz.lviv.ua)
* [Bad Android](https://bad-android.com)

## Use in Joomla! Extension

Expand All @@ -32,10 +31,10 @@ You can then later update using composer:

After installing, you need to require Composer's autoloader:

```
```php
require_once('vendor/autoload.php');

$config['root_path'] = $_SERVER[ 'DOCUMENT_ROOT'];
$config['root_path'] = __DIR__;
$config['img_blank'] = 'images/logos';

$juImg = new JUImage\Image($config);
Expand Down Expand Up @@ -63,7 +62,7 @@ Install extention library (lib_juimage_v3.x.x.zip) using Joomla! Extension Manag
#### Code example
Code for use in your extension.

```
```php
JLoader::register('JUImage', JPATH_LIBRARIES . '/juimage/JUImage.php');

$juImg = new JUImage();
Expand All @@ -75,12 +74,12 @@ $thumb = $juImg->render('images/sampledata/fruitshop/apple.jpg', [
'cache' => 'img'
]);

echo '<img src="'. $thumb .'" alt="Apple" width="300" height="100">';
echo '<img src="'. $thumb .'" alt="Apple" width="300">';
```

or

```
```php
require_once(JPATH_SITE . '/libraries/juimage/vendor/autoload.php');

$juImg = new JUImage\Image();
Expand All @@ -92,21 +91,19 @@ $thumb = $juImg->render('images/sampledata/fruitshop/apple.jpg', [
'cache' => 'img'
]);

echo '<img src="'. $thumb .'" alt="Apple" width="300" height="100">';
echo '<img src="'. $thumb .'" alt="Apple" width="300">';
```
### WebP support

```
```php
<?php

$thumb = $juImg->render('images/sampledata/fruitshop/apple.jpg', [
'w' => '300',
'h' => '100',
'q' => '95',
'webp' => true,
'webp_q' => '80',
'webp_maxq' => '85',
'webp' => true
]);
?>

Expand All @@ -118,7 +115,7 @@ $thumb = $juImg->render('images/sampledata/fruitshop/apple.jpg', [

Display as:

```
```html
<picture>
<source srcset="img/apple.jpg.webp" type="image/webp">
<img src="img/apple.jpg" alt="Apple" width="300" height="100">
Expand All @@ -128,21 +125,19 @@ Display as:
| WebP command | Type | Default | Description
| --- | --- | --- | --- |
| webp | Boolean | false | If `true` add support WebP image. For this option use tag `<picture>`, see in example. |
| webp_q | An integer between 0-100 | auto | Only relevant, when quality is set to "auto". |
| webp_maxq | An integer between 0-100 | 85 | Only relevant, when quality is set to "auto". |

### YouTube and Vimeo support

Youtube:
```
```php
$thumb = $juImg->render('https://www.youtube.com/watch?v=xxxxxxxxxxx', [
'w' => '300',
'h' => '100',
]);
```

Vimeo:
```
```php
$thumb = $juImg->render('https://vimeo.com/xxxxxxxxx', [
'w' => '300',
'h' => '100',
Expand All @@ -151,7 +146,7 @@ $thumb = $juImg->render('https://vimeo.com/xxxxxxxxx', [

### Image size support

```
```php
<?php

$thumb = $juImg->render('images/sampledata/fruitshop/apple.jpg', [
Expand All @@ -168,7 +163,7 @@ echo '<img src="'. $thumb .'" alt="Apple" width="'. $size->width .'" height="'.

Add option to this array:

```
```bash
[
'w' => '300',
'h' => '100',
Expand Down Expand Up @@ -222,4 +217,4 @@ JUImage is based on the [phpThumb() Class ](https://github.com/JamesHeinrich/php

[![JetBrains](https://avatars0.githubusercontent.com/u/878437?s=200&v=4)](https://www.jetbrains.com/)

Thanks to [JetBrains](https://www.jetbrains.com/) for supporting the project through sponsoring some [All Products Packs](https://www.jetbrains.com/products.html) within their [Free Open Source License](https://www.jetbrains.com/buy/opensource/) program.
Thanks to [JetBrains](https://www.jetbrains.com/) for supporting the project through sponsoring some [All Products Packs](https://www.jetbrains.com/products.html) within their [Free Open Source License](https://www.jetbrains.com/buy/opensource/) program.

0 comments on commit d62c204

Please sign in to comment.