Skip to content

[Feature] Support for "auto_pad" crop mode #592

@cod3blox

Description

@cod3blox

It appears that the auto_pad crop mode is currently not implemented or not functioning as expected.

According to the Cloudinary documentation, the auto_pad mode requires the g_auto (gravity) qualifier, along with two of the following: h_ (height), w_ (width), or ar_ (aspect_ratio).

Consider the following example:

import { getCldImageUrl } from 'next-cloudinary';
 
const url = getCldImageUrl({
  width: 960,
  aspectRatio: '16:9',
  crop: 'auto_pad',
  gravity: 'auto',  
  src: '<Public ID>'
});

The generated URL from getCldImageUrl is missing the gravity and aspect_ratio parameters.
Additionally, the console outputs the following warning:

Auto gravity can only be used with crop modes: auto, crop, fill, lfill, fill_pad, thumb. Not applying gravity.

Support for the auto_pad mode would be highly desirable, as it is particularly useful for use cases like product images where maintaining multiple aspect ratios without cropping the subject is important.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions