New Jan 6, 2025

Remove co_black,e_colorize:70 from Cloudinary

Libraries, Frameworks, etc. All from Newest questions tagged reactjs - Stack Overflow View Remove co_black,e_colorize:70 from Cloudinary on stackoverflow.com

When I fetch image data using admin.search, all the image urls has co_black,e_colorize:70 which makes the image darker. I did not gave any transformation options when I both instantiate and send request. How do i remove this option without running string methods?

Init part:

var (
    CLD     *cloudinary.Cloudinary
    CLD_CTX context.Context
)

func InitCldInstance() { cld, _ := cloudinary.New() cld.Config.URL.Secure = true ctx := context.Background()

CLD = cld CLD_CTX = ctx }

func GetInstance() (*cloudinary.Cloudinary, context.Context) { if CLD == nil { panic("cloudinary not initialized") } return CLD, CLD_CTX }

Request part:

func (r *MediaRepository) GetAllImagesFromFolder(
    ctx context.Context,
    folder string,
    limit int,
    nextCursor string,
) (AllImagesFromFolder, error) {
    var result AllImagesFromFolder

res, err := r.cld.Admin.Search(ctx, search.Query{ Expression: "folder:gallery/" + folder, MaxResults: limit, NextCursor: nextCursor, SortBy: []search.SortByField{ { "created_at": search.Direction("desc"), }, }, }) if err != nil { logger.Error.Printf("Get image from folder error: %v", err.Error()) return result, fmt.Errorf("Get image from folder error: %v", err.Error()) }

images := make([]Image, len(res.Assets))

for i, asset := range res.Assets { images[i] = Image{ PublicID: asset.PublicID, Url: asset.SecureURL, } }

result.Images = images result.NextCursor = res.NextCursor

return result, nil }

Fontend part(react):

   const renderImages = () => {
      return images.map((item) => {
         const img = cld
            .image(item.publicId)
            .format("auto")
            .quality("auto")
            .resize(fit().width(450))

return ( <AdvancedImage key={item.publicId} cldImg={img} plugins={[lazyload(), responsive(), accessibility()]} /> ); }); };

Scroll to top