[PR #59] [CLOSED] added option to extract part of an image (manual crop _then_ resize) #254

Closed
opened 2026-02-25 22:34:52 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/flyimg/flyimg/pull/59
Author: @WybrenKoelmans
Created: 6/10/2017
Status: Closed

Base: masterHead: master


📝 Commits (1)

  • a3931ab added option to extract part of an image (manual crop then resize)

📊 Changes

2 files changed (+44 additions, -4 deletions)

View changed files

📝 config/parameters.yml (+11 -2)
📝 src/Core/Service/ImageProcessor.php (+33 -2)

📄 Description

Before I make a lot of work of creating a proper PR, did I miss something or is it not yet possible to do a crop and then a resize without this?

What I'm doing right now is upload an image to storage. The user can then put a box over the image (like this https://foliotek.github.io/Croppie/) and I save the coords for the white box (viewport) for generating the URLs.

Then I defined an nginx rule like this:

location ~ /image/(.+)x(.+)/(.+)_(.+)_(.+)_(.+)/(.+) {
    proxy_pass http://<IP FOR FLYIMG>/upload/w_$1,h_$2,e_1,p1x_$3,p1y_$4,p2x_$5,p2y_$6/http://<MY IMAGE STORAGE>/image/$7;
}

So

http://mywebsite.zz/image/650x520/55_0_448_328/dd78aba6-8fcc-4cbc-91d7-c4777d6ba10f_0eaa14d11e8930f5.jpg

becomes

http://flyimg/upload/h_650,w_520,e_1,p1x_55,p1y_0,p2x_448,p2y_328/http://storage/image/dd78aba6-8fcc-4cbc-91d7-c4777d6ba10f_0eaa14d11e8930f5.jpg

Which will give me exactly what the user cropped in any height and width from the original.

I look forward to your feedback, maybe you know of an easier way or see trouble with this implementation.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/flyimg/flyimg/pull/59 **Author:** [@WybrenKoelmans](https://github.com/WybrenKoelmans) **Created:** 6/10/2017 **Status:** ❌ Closed **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (1) - [`a3931ab`](https://github.com/flyimg/flyimg/commit/a3931ab393ee75fddcd3740455e3ced7f0bfc916) added option to extract part of an image (manual crop _then_ resize) ### 📊 Changes **2 files changed** (+44 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `config/parameters.yml` (+11 -2) 📝 `src/Core/Service/ImageProcessor.php` (+33 -2) </details> ### 📄 Description Before I make a lot of work of creating a proper PR, did I miss something or is it not yet possible to do a crop and then a resize without this? What I'm doing right now is upload an image to storage. The user can then put a box over the image (like this https://foliotek.github.io/Croppie/) and I save the coords for the white box (viewport) for generating the URLs. Then I defined an nginx rule like this: ``` location ~ /image/(.+)x(.+)/(.+)_(.+)_(.+)_(.+)/(.+) { proxy_pass http://<IP FOR FLYIMG>/upload/w_$1,h_$2,e_1,p1x_$3,p1y_$4,p2x_$5,p2y_$6/http://<MY IMAGE STORAGE>/image/$7; } ``` So ``` http://mywebsite.zz/image/650x520/55_0_448_328/dd78aba6-8fcc-4cbc-91d7-c4777d6ba10f_0eaa14d11e8930f5.jpg ``` becomes ``` http://flyimg/upload/h_650,w_520,e_1,p1x_55,p1y_0,p2x_448,p2y_328/http://storage/image/dd78aba6-8fcc-4cbc-91d7-c4777d6ba10f_0eaa14d11e8930f5.jpg ``` Which will give me exactly what the user cropped in any height and width from the original. I look forward to your feedback, maybe you know of an easier way or see trouble with this implementation. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-25 22:34:52 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/flyimg#254
No description provided.