패키지, 저장소 및 앱 카테고리 검색

패키지 상세v0.23.1

cloudinary_public

이 패키지는 API 키나 시크릿 키를 노출하지 않고도 미디어 파일을 직접 Cloudinary에 업로드할 수 있도록 해줍니다.

AndroidiOSmacOSWindowsLinux
30일 다운로드
3.8천
좋아요
128
Pub 점수
150

패키지 설치

flutter pub add cloudinary_public

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

cloudinary_public 패키지는 Flutter 앱에서 Cloudinary로 직접 미디어를 업로드할 수 있게 해주며, 민감한 API 키를 노출할 필요가 없습니다. 서명되지 않은 업로드 프리셋을 사용하여 인증을 안전하게 처리함으로써 클라이언트가 파일을 직접 업로드하면서도 서버 측 보안을 유지할 수 있습니다. 사진 공유나 프로필 사진 업로드와 같은 사용자 생성 콘텐츠가 필요한 애플리케이션에 적합합니다. 이 패키지는 Android, iOS, macOS, Windows 및 Linux 등 여러 플랫폼을 지원합니다.

사용 사례

  • 모바일 앱에서 직접 파일 업로드
  • 사용자 생성 콘텐츠 저장
  • 프로필 사진 업로드
  • 이미지 및 비디오 관리
  • 자격 정보를 노출하지 않고 안전한 미디어 처리

주요 기능

  • API 키 노출 없음
  • 서명되지 않은 업로드 프리셋 지원
  • 크로스 플랫폼 호환성
  • Cloudinary와의 간단한 통합
  • 실시간 업로드 진행률 추적

적합한 대상

  • 미디어 업로드 기능이 있는 모바일 앱
  • 안전한 파일 전송이 필요한 앱
  • 개발자들이 백엔드 인증을 피함
  • 미디어 저장을 위해 Cloudinary를 사용하는 프로젝트
  • 프론트엔드 전용 미디어 처리

고려 사항

  • Cloudinary 업로드 프리셋 설정이 필요합니다
  • 서명되지 않은 업로드에 제한됨
  • Cloudinary의 무료 계층 또는 유료 플랜에 의존
  • 개인 또는 제한된 미디어에 적합하지 않습니다
  • Cloudinary 대시보드를 올바르게 구성해야 합니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

cloudinary_public

Build Status Coverage Status

This package allows you to upload media files directly to cloudinary, without exposing your apiKey or secretKey.

Getting started

Add the dependency cloudinary_public: ^0.23.1 to your project:

import 'package:cloudinary_public/cloudinary_public.dart';

final cloudinary = CloudinaryPublic('CLOUD_NAME', 'UPLOAD_PRESET', cache: false);

Check https://cloudinary.com/documentation/upload_images#unsigned_upload on how to create an upload preset.

Using Image Picker Plugin
var image = await ImagePicker.pickImage(source: ImageSource.camera);

try {
    CloudinaryResponse response = await cloudinary.uploadFile(
        CloudinaryFile.fromFile(image.path, resourceType: CloudinaryResourceType.Image),
    );
    
    print(response.secureUrl);
} on CloudinaryException catch (e) {
  print(e.message);
  print(e.request);
}
Using Multi Image Picker Plugin
final images = await MultiImagePicker.pickImages(maxImages: 4);

List<CloudinaryResponse> uploadedImages = await cloudinary.multiUpload(
images
    .map(
      (image) => CloudinaryFile.fromFutureByteData(
        image.getByteData(),
        identifier: image.identifier,
      ),
    )
    .toList(),
);

print(uploadedImages[0].secureUrl);

Image Transformation

// CloudinaryImage
final cloudinaryImage = CloudinaryImage('https://res.cloudinary.com/demo/image/upload/front_face.png');
// or using the image public id
final cloudinaryImage = cloudinary.getImage('front_face');

final String url = cloudinaryImage.transform().width(150).height(150).gravity('face').crop('thumb').generate();
// or using the shortcut
final String url = cloudinaryImage.thumbnail(width: 150, height: 150).generate();


// Chain example
final url = cloudinaryImage.transform()
    .width(150)
    .height(150)
    .gravity('face')
    .crop('thumb')
    .chain()
    .radius(20)
    .chain()
    .effect('sepia')
    .chain()
    .overlay(cloudinary.getImage('cloudinary_icon'))
    .gravity('south_east')
    .x(5)
    .y(5)
    .width(50)
    .opacity(60)
    .effect('brightness:200')
    .chain()
    .angle(10)
    .generate();
// generates
// https://res.cloudinary.com/demo/image/upload/c_thumb,g_face,h_150,w_150/r_20/e_sepia/e_brightness:200,g_south_east,l_cloudinary_icon,o_60,w_50,x_5,y_5/a_10/front_face.png

Upload Progress

final res = await cloudinary.uploadFile(
  CloudinaryFile.fromFile(
    _pickedFile.path,
    folder: 'hello-folder',
    context: {
      'alt': 'Hello',
      'caption': 'An example image',
    },
  ),
  onProgress: (count, total) {
    setState(() {
      _uploadingPercentage = (count / total) * 100;
    });
  },
);

Upload In Chunks

Use chunked upload when file size is more then 100 Megabytes.

By default, the chunk size is set to 20 Megabytes but can be set to as low as 5 Megabytes by using the chunk_size parameter.

Source: https://cloudinary.com/documentation/upload_images#chunked_asset_upload

final res = await cloudinary.uploadFileInChunks(
  CloudinaryFile.fromFile(
    _pickedFile.path,
    folder: 'hello-folder',
    context: {
      'alt': 'Hello',
      'caption': 'An example upload in chunks',
    },
  ),
  chunkSize: 10000000
  onProgress: (count, total) {
    setState(() {
      _uploadingPercentage = (count / total) * 100;
    });
  },
);

카테고리

의존성

의존성 목록 1 개

소스 저장소

이 패키지를 사용하는 프로젝트