Skip to content

Commit

Permalink
feat-#230: dynamic crop
Browse files Browse the repository at this point in the history
  • Loading branch information
Baroshem committed Nov 4, 2024
1 parent 7c4edb5 commit b59d5ef
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
14 changes: 14 additions & 0 deletions docs/components/content/ImageWithCrop.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<template>
<CldImage
src="cld-sample-5"
width="987"
height="987"
alt="Sample Product"
:crop="{
type: 'thumb',
width: 600,
height: 600,
source: true,
}"
/>
</template>
15 changes: 15 additions & 0 deletions docs/content/2.components/CldImage/3.examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,21 @@ crop

:cld-image{src="images/woman-headphones" width="1200" height="1200" alt="test" crop="thumb" style="text-align: center; margin: 0 auto"}

Cloudinary additionally supports dynamic crop modes like thumb that may provide a different result based on the given width and height. To help provide more options for controlling cropping images, you can specify and object or array of objects.

For instance, to crop the original source image, which will then later resize it to the initial width and height, you can use:

```html
:crop="{
type: 'thumb',
width: 600,
height: 600,
source: true,
}"
```

:image-with-crop{style="text-align: center; margin: 0 auto"}

#### Fill

`fillBackground`: Fills the background of an image using Generative AI
Expand Down
7 changes: 6 additions & 1 deletion playground/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,12 @@ const onError = (
width="987"
height="987"
alt="Sample Product"
crop="fill"
:crop="{
type: 'thumb',
width: 600,
height: 600,
source: true,
}"
:overlays="[
{
position: {
Expand Down

0 comments on commit b59d5ef

Please sign in to comment.