paktdigital / focus-point-bundle
Symfony bundle for third774's image focus, for image cropping based on a focus point.
Installs: 589
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 2
Forks: 2
Open Issues: 16
Type:symfony-bundle
Requires
- php: ^8.0
- liip/imagine-bundle: ^2.0
- symfony/asset: ^5.0
- symfony/config: ^5.0
- symfony/dependency-injection: ^5.0
- symfony/form: ^5.0
- symfony/options-resolver: ^5.0
- vich/uploader-bundle: ^1.16
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.16
- phpstan/phpstan: 0.12.*
Suggests
- symfony/twig-bundle: Allows usage of the focus point Twig extension.
- dev-master
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- dev-dependabot/npm_and_yarn/json5-1.0.2
- dev-dependabot/npm_and_yarn/qs-6.5.3
- dev-dependabot/npm_and_yarn/decode-uri-component-0.2.2
- dev-dependabot/npm_and_yarn/terser-4.8.1
- dev-dependabot/npm_and_yarn/minimist-1.2.6
- dev-dependabot/npm_and_yarn/ajv-6.12.6
- dev-dependabot/npm_and_yarn/node-sass-7.0.0
- dev-dependabot/npm_and_yarn/path-parse-1.0.7
- dev-dependabot/npm_and_yarn/postcss-7.0.36
- dev-dependabot/npm_and_yarn/browserslist-4.16.6
- dev-dependabot/npm_and_yarn/hosted-git-info-2.8.9
- dev-dependabot/npm_and_yarn/lodash-4.17.21
- dev-dependabot/npm_and_yarn/ssri-6.0.2
- dev-dependabot/npm_and_yarn/y18n-3.2.2
- dev-dependabot/npm_and_yarn/elliptic-6.5.4
- dev-dependabot/npm_and_yarn/ini-1.3.8
This package is auto-updated.
Last update: 2025-07-06 10:28:17 UTC
README
FocusPointBundle
This Symfony bundle provides an liip/imagine-bundle filter extension, a form type (using VichImageType) and an optional Twig extension for third774's image focus.
Requires:
- liip/imagine-bundle
- vich/uploader-bundle
Usage
Image entity
Implement ImageInterface
in the entity you use for your images
use PaktDigital\FocusPointBundle\Entity\ImageInterface; class Image implements ImageInterface
and add
/** * @ORM\Column(type="json_array") */ private $focusPoint = []; public function getFocusPoint(): ?array { return $this->focusPoint; } public function setFocusPoint(array $focusPoint): self { $this->focusPoint = $focusPoint; return $this; }
Configure image_entity
in the yaml file with your image entity
paktdigital_focus_point: image_entity: '\App\Entity\Media\Image'
The filter
You can apply the filter to an image by adding paktdigital.focuspoint
to the image's filters in the liip_image.yml
configuration
exampleImage: quality: 100 filters: paktdigital.focuspoint: size: [500, 500]
Field type
Add ImageFocusType
to your form and add the css class js-focus-picker
, e.g. in EasyAdmin
Page: class: App\Entity\Page form: fields: - { property: 'image', type: 'PaktDigital\FocusPointBundle\Form\ImageFocusType', css_class: 'js-focus-picker' } - active - title - intro - active
and add the assets
assets: js: - '/bundles/paktdigitalfocuspoint/main.js' css: - '/bundles/paktdigitalfocuspoint/main.css'
In Twig
Twig filter extension
<img src="{{ examplePage.image | paktdigital_focus('exampleImage') }}" />