Skip to content

tibemolde/focalpoint

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 

Repository files navigation

Focalpoint for Craft - public beta

Squarespace style focal points for Craft assets to get natural cropping for images to various formats.

Focal point editing

The image processing and the api is still a bit rough around the edges (GD only, no way to clear generated crop cache, should be a way to get an array of image sizes for srcset, etc... ), improvements are coming. Feel free to submit issues and/or pull requests.

Installation

  • Install the plugin (the focalpoint folder)
  • Setup the output folder in plugin settings, create this directory and make it writable by the web server if needed
  • Add a focalpoint field with the handle focalPoint to your the fields of the asset source you want to get cropped images for.

Usage

To get the url to the cropped image, use the craft.focalpoint.getImgCrop method:

{% set image = craft.assets().limit(1).first() %}
{% set croppedImage = craft.focalpoint.getImgCrop(image, 720, 360) %}
<img src="{{ croppedImage.url }}">

About

Focal point cropping for images in Craft

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published