phppup Posted April 7 Share Posted April 7 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? Quote Link to comment https://forums.phpfreaks.com/topic/327295-reduce-file-size-before-upload/ Share on other sites More sharing options...
Strider64 Posted April 7 Share Posted April 7 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? Quote Link to comment https://forums.phpfreaks.com/topic/327295-reduce-file-size-before-upload/#findComment-1652838 Share on other sites More sharing options...
phppup Posted April 8 Author Share Posted April 8 @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? Quote Link to comment https://forums.phpfreaks.com/topic/327295-reduce-file-size-before-upload/#findComment-1652839 Share on other sites More sharing options...
Solution gizmola Posted April 8 Solution Share Posted April 8 11 hours ago, phppup said: 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? In order to "upload" a file to a server, and make that "quicker" you need to have optimized the size of the photo on your workstation. PHP doesn't come into it. Quote Link to comment https://forums.phpfreaks.com/topic/327295-reduce-file-size-before-upload/#findComment-1652854 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.