Jump to content

Recommended Posts

Some time ago I was playing with PHP code to minimize the size of images.

My primary purpose was to reduce the file size so that uploading would be quicker and thereby encounter fewer instances of exceeding the upload limits of the hosting server.

It recently occurred to me that this was a futile exercise because once PHP was involved, the files at full size had already engaged with the server.

Am I correct in my assumption?
Is there a reliable way to approach what I had initially intended?

Link to comment
https://forums.phpfreaks.com/topic/327295-reduce-file-size-before-upload/
Share on other sites

I use Intervention using composer which is a very handy utility.

    // Load the image
    $image = Image::make($image_path);

    // Resize the image
    $image->resize(2048, 1365, function ($constraint) {
        $constraint->aspectRatio();
        $constraint->upsize();
    });

    // Save the new image
    $image->save($image_path, 100);

You can do other image manipulation with Intervention as well and pretty easily. I don't know if this is something you are looking for?

@Strider64 I think my intention (at first, anyway) was to increase upload speed (especially if a few images were involved) and avoid upload size maximum limits (that the server /hosting service enforces).

Will this actually address the issue?

Is there another reliable resolution?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.