KOSUNI KOREA
Korean News in English
Technology

Implementing Image Sending in Chat Apps: A Step-by-Step Guide

Published October 15, 2026 · 2 views
Implementing Image Sending in Chat Apps: A Step-by-Step Guide

What You'll Learn in This Lesson

Last lesson, we implemented the Typing Indicator feature.

Now chats flow naturally in real time.

In this lesson, we'll implement one of the most commonly used features in messaging apps:

Image Sending Functionality

We'll cover these topics together:

  • Selecting images

  • Uploading to Storage

  • Saving messages

  • Displaying images

  • Showing upload progress

  • Error handling

By the end of this lesson, you'll be able to freely send and receive photos.


Why Use Storage?

Images aren't stored directly in the Database.

Instead, we upload images to Supabase Storage and save only the image URL in the Database.

This approach is much more efficient for performance and management.


Storage Structure Design

Create a dedicated Bucket for chat images in Storage.

For example, you could use:

chat-images

Store images in folders by chat room for easier management.


Requesting Help from Cursor AI

First, ask Cursor AI to implement the image upload feature using Supabase Storage:

Implement a feature that uploads chat images using Supabase Storage.

After uploading, save the image URL along with the message.

The AI will write both upload and storage code for you.


Selecting Images

Add a photo icon button next to the chat input field.

When users click it, a file selection window opens.

On mobile, users can choose from gallery or camera.


Starting Upload

Once an image is selected, upload begins to Storage.

After completion, you receive a public URL.

This URL gets saved along with the message data.


Showing Upload Progress

Since uploads can take time, show progress status.

For example:

Uploading...

Or display a percentage to let users easily see the current status.


Displaying in Chat

Image messages are displayed differently from text messages.

Show image thumbnails first, then allow clicking for larger viewing.


Enlarged Image View

Tapping an image displays it full screen.

On mobile, supporting pinch zoom (pinch zoom) improves usability.


File Size Limit

Very large images take longer to upload.

This project limits uploads to a maximum of 5MB.

If exceeded, display an alert message.


Supported File Formats

Allow these image formats:

  • JPG

  • PNG

  • WEBP

Block unsupported formats to ensure security.


Improving with Cursor AI

After implementation, ask Cursor AI:

Improve the image upload feature for better stability.

The AI suggests improvements like:

  • File validation

  • Retry uploads

  • Image compression


Performance Optimization

Don't display original images immediately.

Show thumbnails first for faster chat screen loading.

Load original images only when needed.


Mobile UX Considerations

Keep the input field usable while sending photos.

After upload completes, add it automatically to chat.

Users don't need to wait for uploads to finish.


Testing Process

Test in this order:

  1. Selecting photos

  2. Uploading to Storage

  3. Saving to Database

  4. Realtime receiving

  5. Displaying images

  6. Verifying enlarged view

If all functions work properly, the image sending feature is complete.


GitHub Commit

After completion, ask Cursor AI to write a commit message:

Write a commit message for implementing the image sending feature.

Feature-specific commits greatly help project management.


Additional Features in Production

In real services, you'd also include features like:

  • Multi-image sending

  • Image compression

  • Removing EXIF data

  • Spoiler images

  • Automatic resizing

This project implements only the basic image sending functionality.


Now You Can Have Richer Chats

After this lesson, users will be able to send and receive photos freely alongside text messages.

The chat app now has nearly identical functionality to real messaging services.


Next Lesson Preview

In the next lesson, we'll implement file sending features for PDFs, ZIP files, and documents that can be uploaded and downloaded within chat rooms.


Conclusion

We've implemented image sending functionality in this lesson.

By covering Supabase Storage uploads, image message display, zoom view, and upload progress indicators, we've created a messaging-level image sharing feature.

In the next lesson, we'll add file sending capabilities to enable exchanging various data types in our chat application.

FAQ

Why store images in Storage instead of Database?

Storing only image URLs in the database while keeping actual images in Storage improves performance and makes management more efficient.

What file formats are supported for images?

Supported formats include JPG, PNG, and WEBP. Unsupported formats are blocked to ensure security.

How does the app handle large image uploads?

The app limits uploads to 5MB maximum. Larger files trigger an alert message.

Korean Source

This article is an English localization of a Korean-language report from BlogScore. Original: [바이브코딩 강좌] 49강. 이미지 전송 기능 구현하기