Skip to content

[add] a trivial way to support GIF - #225

Open
chunibyo-wly wants to merge 2 commits into
Afilmory:mainfrom
chunibyo-wly:draftgif
Open

[add] a trivial way to support GIF#225
chunibyo-wly wants to merge 2 commits into
Afilmory:mainfrom
chunibyo-wly:draftgif

Conversation

@chunibyo-wly

Copy link
Copy Markdown

Currently, the GIF is rendered using WebGLImageViewer. For example

Add a temporary solution to support GIF using the image tag.

Copilot AI review requested due to automatic review settings February 3, 2026 11:04
@safedep

safedep Bot commented Feb 3, 2026

Copy link
Copy Markdown

SafeDep Report Summary

Green Malicious Packages Badge Green Vulnerable Packages Badge Green Risky License Badge

No dependency changes detected. Nothing to scan.

This report is generated by SafeDep Github App

@vercel

vercel Bot commented Feb 3, 2026

Copy link
Copy Markdown

@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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 .gif to the list of supported image formats in the builder constants
  • Introduced an isGIF property to the ProgressiveImageProps interface
  • Implemented conditional rendering in ProgressiveImage component to use a plain <img> tag for GIF files instead of WebGLImageViewer

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.

Comment on lines +176 to +181
<img
src={blobSrc}
alt={alt}
className="absolute inset-0 h-full w-full object-contain"
width={width}
height={height}

Copilot AI Feb 3, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
<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)}

Copilot uses AI. Check for mistakes.
@Innei

Innei commented Feb 4, 2026

Copy link
Copy Markdown
Contributor

什么场景会上传 GIF 的图片?

@chunibyo-wly

chunibyo-wly commented Feb 4, 2026

Copy link
Copy Markdown
Author

我是整理自己绘制原理演示图片参考图集的时候会下载到这种 https://chunibyo.afilmory.art/?tags=Research

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants