Skip to content

Commit

Permalink
WIP fix image cropper
Browse files Browse the repository at this point in the history
  • Loading branch information
richardTowers committed Nov 6, 2024
1 parent 8be74fd commit 53498f2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/assets/javascripts/components/image-cropper.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {}
this.cropper = new window.Cropper(this.$image, {
// eslint-disable-line
viewMode: 2,
aspectRatio: 3 / 2,
aspectRatio: this.$targetWidth / this.$targetHeight,
autoCrop: true,
autoCropArea: 1,
guides: false,
Expand Down
2 changes: 2 additions & 0 deletions app/views/admin/edition_images/crop.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
<p>If you need to crop your image, use your cursor or the arrow keys and “<kbd>+</kbd>” and “<kbd>-</kbd>” to select a part of the image. The part you select will be resized for GOV.UK. The shape is fixed.</p>
</div>

<%= hidden_field_tag("image[image_data][image_kind]", @new_image.image_data.image_kind) %>
<%= render "components/image_cropper", {
name: "image[image_data][file]",
src: @data_url,
Expand Down

0 comments on commit 53498f2

Please sign in to comment.