[add] a trivial way to support GIF - #225
Conversation
SafeDep Report SummaryNo dependency changes detected. Nothing to scan. This report is generated by SafeDep Github App |
|
@chunibyo-wly is attempting to deploy a commit to the innei-dev Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Pull request overview
This PR adds support for GIF images in the photo viewer application. The implementation uses a plain HTML <img> tag to render GIFs, which preserves animation but differs from the approach used for other image formats.
Changes:
- Added
.gifto the list of supported image formats in the builder constants - Introduced an
isGIFproperty to theProgressiveImagePropsinterface - Implemented conditional rendering in
ProgressiveImagecomponent to use a plain<img>tag for GIF files instead ofWebGLImageViewer
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/builder/src/constants/index.ts | Added .gif extension to SUPPORTED_FORMATS set, enabling GIF files to be processed by storage providers |
| apps/web/src/modules/viewer/types.ts | Added isGIF optional boolean property to ProgressiveImageProps interface |
| apps/web/src/modules/viewer/ProgressiveImage.tsx | Added conditional rendering logic to use plain HTML <img> tag for GIF images, preserving animation |
| apps/web/src/modules/viewer/PhotoViewer.tsx | Added logic to pass isGIF={photo.format === 'GIF'} prop to ProgressiveImage component |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| <img | ||
| src={blobSrc} | ||
| alt={alt} | ||
| className="absolute inset-0 h-full w-full object-contain" | ||
| width={width} | ||
| height={height} |
There was a problem hiding this comment.
The current implementation for GIF rendering uses a plain HTML img tag, which lacks pan and zoom functionality that other image formats have through WebGLImageViewer or DOMImageViewer. This creates an inconsistent user experience. Consider wrapping the GIF in a DOMImageViewer (similar to how HDR and Live Photos are handled) to provide consistent pan/zoom capabilities while still preserving GIF animation. DOMImageViewer should work with animated GIFs since it uses a standard img element internally.
| <img | |
| src={blobSrc} | |
| alt={alt} | |
| className="absolute inset-0 h-full w-full object-contain" | |
| width={width} | |
| height={height} | |
| <DOMImageViewer | |
| ref={domImageViewerRef} | |
| onZoomChange={onDOMTransformed} | |
| minZoom={minZoom} | |
| maxZoom={maxZoom} | |
| src={blobSrc} | |
| alt={alt} | |
| highResLoaded={highResLoaded} | |
| onLoad={() => setState.setIsHighResImageRendered(true)} |
|
什么场景会上传 GIF 的图片? |
|
我是整理自己绘制原理演示图片参考图集的时候会下载到这种 https://chunibyo.afilmory.art/?tags=Research |
Currently, the GIF is rendered using
WebGLImageViewer. For exampleAdd a temporary solution to support GIF using the image tag.