Skip to content

Commit

Permalink
Namespace correction to meet Yii2 requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
PELock committed Mar 17, 2021
1 parent f6e0423 commit 2d8dacf
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ it will automatically generate an extra image in new [WebP](https://developers.g
Replace your `IMG` tag within your `HTML` templates with a call to:

```php
<?= \pelock\imgopt\ImgOpt::widget(["src" => "/images/product/extra.png", "alt" => "Extra product" ]) ?>
<?= \PELock\ImgOpt\ImgOpt::widget(["src" => "/images/product/extra.png", "alt" => "Extra product" ]) ?>
```

(Image path is relative to [Yii2 Framework @webroot alias](https://www.yiiframework.com/wiki/667/yii-2-list-of-path-aliases-available-with-default-basic-and-advanced-app))
Expand Down Expand Up @@ -82,7 +82,7 @@ If the generated WebP image is larger than the original image, the default `<img
If for some reason you want to disable WebP file serving via the HTML `<picture>` tag, you can do it per widget settings:

```php
<?= \pelock\imgopt\ImgOpt::widget(["src" => "/images/product/extra.png", "alt" => "Extra product", "disable" => true ]) ?>
<?= \PELock\ImgOpt\ImgOpt::widget(["src" => "/images/product/extra.png", "alt" => "Extra product", "disable" => true ]) ?>
```

## Recreate WebP file
Expand All @@ -92,7 +92,7 @@ The widget code automatically detects if there's a WebP image in the directory w
If you wish to force the widget code to recreate it anyway, pass the special param to the widget code:

```php
<?= \pelock\imgopt\ImgOpt::widget(["src" => "/images/product/extra.png", "alt" => "Extra product", "recreate" => true ]) ?>
<?= \PELock\ImgOpt\ImgOpt::widget(["src" => "/images/product/extra.png", "alt" => "Extra product", "recreate" => true ]) ?>
```

You might want to recreate all of the WebP files and to do that without modifying, change the widget source code from:
Expand Down Expand Up @@ -129,7 +129,7 @@ Instead of:
You can replace it with more compact widget code:

```php
<?= \pelock\imgopt\ImgOpt::widget(["lightbox_data" => "image-1", "lightbox_src" => "/images/sunset.jpg', "src" => "/images/sunset-thumbnail.jpg', "alt" => "Sunset" ]) ?>
<?= \PELock\ImgOpt\ImgOpt::widget(["lightbox_data" => "image-1", "lightbox_src" => "/images/sunset.jpg', "src" => "/images/sunset-thumbnail.jpg', "alt" => "Sunset" ]) ?>
```

And it will generate this HTML code:
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pelock/yii2-imgopt",
"version": "1.1.0",
"version": "1.1.1",
"description": "Image optimization widget for Yii2 Framework with auto WebP image format generation from PNG/JPG files.",
"type": "yii2-extension",
"keywords": ["image", "optimization", "yii2", "webp", "jpg", "png", "generator"],
Expand All @@ -18,7 +18,7 @@
},
"autoload": {
"psr-4": {
"PELock\\yii2-imgopt\\": "src/"
"PELock\\ImgOpt\\": "src/"
}
}
}
Binary file added img/yii2-imgopt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/yii2-imgopt.webp
Binary file not shown.

0 comments on commit 2d8dacf

Please sign in to comment.