[GH-ISSUE #209] Feature request: Direct upload endpoint #701

Closed
opened 2026-03-15 15:06:33 +03:00 by kerem · 3 comments
Owner

Originally created by @roman-vohnik on GitHub (Apr 24, 2019).
Original GitHub issue: https://github.com/flyimg/flyimg/issues/209

Hi, first of all - thanks for the great work on this project.

Flyimg is made for image manipulations + serving cached images. But what about new option = to use flyimg only for image manipulations like API service? There can be route / endpoint for direct upload of image in raw format (maybe base64 encoded in POST data). Then source images does not have to be public and downloaded from flyimg. Even works from localhost when developing.

All of this is because our different approach. We have flyimg on separate server as a service and main servers background jobs (in queue) are calling flyimg and saving result images to our storage which is served by our nginx on different domain.

Sounds good to you?

I have a working prototype, but I am not so familiar with silex / symfony. It is something like:

public function fooAction(string $options): Response
    {
		$request = Request::createFromGlobals();

		$encodedImage = $request->get('image');

		if ($encodedImage === null || strlen($encodedImage) === 0) {
			$this->response->setStatusCode(500, 'Missing "image" in post data');
		} else {
			$inputImage = base64_decode($encodedImage);

			$filename = TMP_DIR . uniqid('/post-original-', true);
			file_put_contents($filename, $inputImage);

			$outputImage = $this->imageHandler()->processImage($options, $filename);

			$this->response->generateImageResponse($outputImage);

			unlink($filename);
		}

        return $this->response;
    }
Originally created by @roman-vohnik on GitHub (Apr 24, 2019). Original GitHub issue: https://github.com/flyimg/flyimg/issues/209 Hi, first of all - thanks for the great work on this project. Flyimg is made for image manipulations + serving cached images. But what about new option = to use flyimg only for image manipulations like API service? There can be route / endpoint for direct upload of image in raw format (maybe base64 encoded in POST data). Then source images does not have to be public and downloaded from flyimg. Even works from localhost when developing. All of this is because our different approach. We have flyimg on separate server as a service and main servers background jobs (in queue) are calling flyimg and saving result images to our storage which is served by our nginx on different domain. Sounds good to you? I have a working prototype, but I am not so familiar with silex / symfony. It is something like: ``` public function fooAction(string $options): Response { $request = Request::createFromGlobals(); $encodedImage = $request->get('image'); if ($encodedImage === null || strlen($encodedImage) === 0) { $this->response->setStatusCode(500, 'Missing "image" in post data'); } else { $inputImage = base64_decode($encodedImage); $filename = TMP_DIR . uniqid('/post-original-', true); file_put_contents($filename, $inputImage); $outputImage = $this->imageHandler()->processImage($options, $filename); $this->response->generateImageResponse($outputImage); unlink($filename); } return $this->response; } ```
Author
Owner

@sadok-f commented on GitHub (May 17, 2019):

Hi @roman-vohnik!
Thank you very much for your request (sorry for this late response), it sounds interesting for us as well.
As I understand for you, you already implement it in your servers?
if you don't mind you can create a PR and we'll review it and check it out.

We'd love to include more people as contributors!

Thank you again!

<!-- gh-comment-id:493363182 --> @sadok-f commented on GitHub (May 17, 2019): Hi @roman-vohnik! Thank you very much for your request (sorry for this late response), it sounds interesting for us as well. As I understand for you, you already implement it in your servers? if you don't mind you can create a PR and we'll review it and check it out. We'd love to include more people as contributors! Thank you again!
Author
Owner

@github-actions[bot] commented on GitHub (Aug 13, 2023):

This issue is stale because it has been open for 30 days with no activity.

<!-- gh-comment-id:1676186005 --> @github-actions[bot] commented on GitHub (Aug 13, 2023): This issue is stale because it has been open for 30 days with no activity.
Author
Owner

@github-actions[bot] commented on GitHub (Aug 27, 2023):

This issue was closed because it has been inactive for 14 days since being marked as stale.

<!-- gh-comment-id:1694547359 --> @github-actions[bot] commented on GitHub (Aug 27, 2023): This issue was closed because it has been inactive for 14 days since being marked as stale.
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#701
No description provided.