이미지 크기 조절
Made by Firebase
Resizes images uploaded to Cloud Storage to a specified size, and optionally keeps or deletes the original image.
이 확장 프로그램의 작동 방식
Use this extension to create resized versions of an image uploaded to a Cloud Storage bucket.
When you upload an image file to your specified Cloud Storage bucket, this extension:
- Creates a resized image with your specified dimensions.
- Names the resized image using the same name as the original uploaded image, but suffixed with your specified width and height.
- Stores the resized image in the same Storage bucket as the original uploaded image.
You can even configure the extension to create resized images of different dimensions for each original image upload. For example, you might want images that are 200x200, 400x400, and 680x680 - this extension can create these three resized images then store them in your bucket.
The extension automatically copies the following metadata, if present, from the original image to the resized image(s):
Content-Type, and user-provided metadata (a new Firebase storage download token will be generated on the resized image(s) if the original metadata contains a token). Note that you can optionally configure the extension to overwrite the
Cache-Control value for the resized image(s).
Detailed configuration information
To configure this extension, you specify a maximum width and a maximum height (in pixels, px). This extension keeps the aspect ratio of uploaded images constant and shrinks the image until the resized image's dimensions are at or under your specified max width and height.
For example, say that you specify a max width of 200px and a max height of 100px. You upload an image that is 480px wide by 640px high, which means a 0.75 aspect ratio. The final resized image will be 75px wide by 100px high to maintain the aspect ratio while also being at or under both of your maximum specified dimensions.
Before installing this extension, make sure that you've set up a Cloud Storage bucket in your Firebase project.
To install an extension, your project must be on the Blaze (pay as you go) plan
- You will be charged a small amount (typically around $0.01/month) for the Firebase resources required by this extension (even if it is not used).
- This extension uses other Firebase and Google Cloud Platform services, which have associated charges if you exceed the service’s free tier:
- Cloud Storage
- Cloud Functions (Node.js 10+ runtime. See FAQs)
구성할 수 있는 항목
- Cloud Functions location
- 이미지용 Cloud Storage 버킷
- 크기가 조절된 이미지의 크기
- Deletion of original file
- 크기가 조절된 이미지의 Cloud Storage 경로
- 크기가 조절된 이미지의 Cache-Control 헤더
- Convert image to preferred type
유형: Cloud Function
설명: Listens for new images uploaded to your specified Cloud Storage bucket, resizes the images, then stores the resized images in the same bucket. Optionally keeps or deletes the original images.
확장 프로그램 설치 방법
Firebase Console 사용
Firebase Console을 사용해 확장 프로그램을 설치하고 관리할 수 있습니다.Console을 사용해 설치하기
Firebase CLI 사용
Firebase CLI를 사용해 확장 프로그램을 설치하고 관리할 수도 있습니다.
1단계: 다음 npm 명령어를 실행하여 CLI를 설치하거나 최신 CLI 버전으로 업데이트합니다.
npm install -g firebase-tools작동하지 않는 경우 Firebase CLI 참조를 살펴보거나 npm 권한을 변경하세요.
2단계: 다음 명령어를 실행하여 이 확장 프로그램을 설치합니다.
firebase ext:install storage-resize-images --project=projectId_or_alias