PHPackages                             antey/instagram-image - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Image &amp; Media](/categories/media)
4. /
5. antey/instagram-image

ActiveLibrary[Image &amp; Media](/categories/media)

antey/instagram-image
=====================

Library for resizing images according to instagram requirements

1.0.0(3y ago)03MITPHPPHP &gt;=7.4

Since Dec 9Pushed 6mo ago1 watchersCompare

[ Source](https://github.com/a-kryvenko/php-instagram-image)[ Packagist](https://packagist.org/packages/antey/instagram-image)[ Docs](https://github.com/a-kryvenko/php-instagram-image)[ RSS](/packages/antey-instagram-image/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (5)Versions (2)Used By (0)

php-instagram-image
===================

[](#php-instagram-image)

PHP library designed for easy image formatting for Instagram according to Instagram guidelines.

[![tests workflow](https://github.com/a-kryvenko/php-instagram-image/actions/workflows/tests.yml/badge.svg)](https://github.com/a-kryvenko/php-instagram-image/actions/workflows/tests.yml/badge.svg)[![Coverage Status](https://camo.githubusercontent.com/69c908684b568686336db0c59ae910a32c784733ab4323c4dad17cb7366fe98c/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f612d6b727976656e6b6f2f7068702d696e7374616772616d2d696d6167652f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/a-kryvenko/php-instagram-image?branch=master)[![License: MIT](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667)](https://opensource.org/licenses/MIT)

---

Setup
-----

[](#setup)

Via composer:

```
$ composer require antey/instagram-image
```

Or by cloning repository

Requirements
------------

[](#requirements)

- PHP version: &gt;= 7.4;
- PHP extensions: gd.

Dependencies
------------

[](#dependencies)

- [php-image-resize](https://github.com/gumlet/php-image-resize)
- [php-image-slice](https://github.com/antey/php-image-slice)

Usage
-----

[](#usage)

This package allow to resize image to any resolution, according to instagram requirements or get optimal resolution for post or gallery (description of features is below).

### Instagram resolutions

[](#instagram-resolutions)

- Profile photo - 360x360 px;
- Stories - 1080x1920 px;
- Reels - 1080x1920 px;
- IGTV cover - 420x654 px;
- Square post - 1080x1080 px;
- Landscape post - 1080x564 px;
- Portrait post - 1080x1350 px;

### Resizing

[](#resizing)

Package allow to simple resize original image into one of instagram images, using one of methods: `getProfile`, `getIgtvCover`, `getSinglePostSquare`, `getSinglePostLandscape` and `getSinglePostPortrait`.

### Slicing

[](#slicing)

Different to simple resizing, instagram also allow to publish some multiple images. It can be `Stories`, `Reels`, `Post` with several images. To create this types of images, package provide methods, that resize and slice original image into a pieces. List of this methods: `getStories`, `getReels`, `getGallerySquare`, `getGalleryLandscape`, `getGalleryPortrait`.

### Optimal resizing

[](#optimal-resizing)

To simplify work with `Post`, package provide methods, that will automatically find most reliable type (single image or gallery) and resolution (Square, Landscape, Portrait) for given image and return path to resized image, or paths of sliced pieces. It's `getSinglePostOptimal`, `getGalleryOptimal`, `getPostOptimal`.

Available features
------------------

[](#available-features)

### Resizing initialization

[](#resizing-initialization)

```
use Antey\InstagramImage\InstagramImageResize;

$imageResize = new InstagramImageResize();
```

### Resizing simple images

[](#resizing-simple-images)

For simple images (like a `Profile`, `Stories`, `Reels`, `IGTVCover`) resized image (or images gallery) will be created by single specified method.

#### getProfile

[](#getprofile)

```
$imageResize->getProfile(string $filename, string $path = ''): string;
```

Convert given image into jpeg, resize to profile resolution and return path to result image. If destination empty - will replace original file.

#### getStories

[](#getstories)

```
$imageResize->getStories(string $filename, string $path = ''): array;
```

Convert given image into jpeg, resize to stories resolution and slice into several stories images, if it possible. Return array of paths to result images. If destination empty - will store result file near to original file.

#### getReels

[](#getreels)

```
$imageResize->getReels(string $filename, string $path = ''): array;
```

Convert given image into jpeg, resize to Reels resolution and slice into several reels images, if it possible. Return array of paths to result images. If destination empty - will store result file near to original file.

#### getIgtvCover

[](#getigtvcover)

```
$imageResize->getIgtvCover(string $filename, string $path = ''): string;
```

Convert given image into jpeg, resize to IGTVCover resolution and return path to result image. If destination empty - will replace original file.

### Resizing post images

[](#resizing-post-images)

Different to simple images, `Post` resizing is tricky. Instagram allow publishing post int three resolutions: 1080x1080, 1080x565, 1080x1350. Also, there is availability to publish gallery of post images. So, to manipulate post resizing, we need additional set of methods.

#### getSinglePostSquare

[](#getsinglepostsquare)

```
$imageResize->getSinglePostSquare(string $filename, string $path = ''): string;
```

Convert given image into jpeg, resize to square post resolution and return path to result image. If destination empty - will replace original file.

#### getSinglePostLandscape

[](#getsinglepostlandscape)

```
$imageResize->getSinglePostLandscape(string $filename, string $path = ''): string;
```

Convert given image into jpeg, resize to landscape post resolution and return path to result image. If destination empty - will replace original file.

#### getSinglePostPortrait

[](#getsinglepostportrait)

```
$imageResize->getSinglePostPortrait(string $filename, string $path = ''): string;
```

Convert given image into jpeg, resize to portrait post resolution and return path to result image. If destination empty - will replace original file.

#### getSinglePostOptimal

[](#getsinglepostoptimal)

```
$imageResize->getSinglePostOptimal(string $filename, string $path = ''): string;
```

Convert given image into jpeg, resize to most conformity post resolution and return path to result image. If destination empty - will replace original file.

#### getGallerySquare

[](#getgallerysquare)

```
$imageResize->getGallerySquare(string $filename, string $path = ''): array;
```

Convert given image into jpeg, slice to several images in square post resolution and return paths to result images. If destination empty - will be stored ner to original image.

#### getGalleryLandscape

[](#getgallerylandscape)

```
$imageResize->getGalleryLandscape(string $filename, string $path = ''): array;
```

Convert given image into jpeg, slice to several images in landscape post resolution and return paths to result images. If destination empty - will be stored ner to original image.

#### getGalleryPortrait

[](#getgalleryportrait)

```
$imageResize->getGalleryPortrait(string $filename, string $path = ''): array;
```

Convert given image into jpeg, slice to several images in portrait post resolution and return paths to result images. If destination empty - will be stored ner to original image.

#### getGalleryOptimal

[](#getgalleryoptimal)

```
$imageResize->getGalleryOptimal(string $filename, string $path = ''): array;
```

Convert given image into jpeg, and slice to several images in most conformity post resolution, then return path to result image. If destination empty - will be stored ner to original image.

#### getOptimalPost

[](#getoptimalpost)

```
$imageResize->getOptimalPost(string $filename, string $path = ''): array;
```

Convert given image into jpeg, and based on image resolution just resize into optimal post resolution, or slice to several images in most conformity post resolution, then return path to result image. If destination empty - will be stored ner to original image.

---

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance47

Moderate activity, may be stable

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1253d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b04ef163fa5e453b0bba91e7e97bb030870b78c8a03274045faf88974648513e?d=identicon)[a-kryvenko](/maintainers/a-kryvenko)

---

Top Contributors

[![a-kryvenko](https://avatars.githubusercontent.com/u/9430313?v=4)](https://github.com/a-kryvenko "a-kryvenko (13 commits)")

---

Tags

phpinstagramimageresizegallerystoriesautoscalereels

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/antey-instagram-image/health.svg)

```
[![Health](https://phpackages.com/badges/antey-instagram-image/health.svg)](https://phpackages.com/packages/antey-instagram-image)
```

###  Alternatives

[gumlet/php-image-resize

PHP class to re-size and scale images

1.2k5.7M54](/packages/gumlet-php-image-resize)[stefangabos/zebra_image

A single-file, lightweight PHP library designed for efficient image manipulation featuring methods for modifying images and applying filters

141110.4k6](/packages/stefangabos-zebra-image)[yncki/php-fast-image-compare

Image Comparer with different aspect ratios and sizes. Can extract duplicate and unique images in directory and much more.

1869.4k](/packages/yncki-php-fast-image-compare)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
