-
-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Thumbnail generation on upload #18
Comments
Hi, I've actually implemented thumbs in your library for my own project: I've used the image intervention library to make images in /src/services/MediaManager.php previously you had a saveFiles() method, which I slightly modified:
The backup() method is in case you want to make multiple thumb sizes. This simple code could be easily made into a separate method within the file, which accepts the three values: method for image manipulation (fit, crop, resize), width and height. |
@Brle88 amazing!!! Since you already have this working, would you be able to submit a PR with your above changes in? If you've made any other changes I'd love to hear about them and consider them for inclusion! |
Sure, the only thing I changed was adding the image intervention library, using it in the MediaManager.php and adding a editing a single method:
I dont have the original method saved, but I did change the path, and the name - this was a quick and a dirty solution, I would propose a separate method for thumbs. |
@Brle88 thanks for that! I'll try adding the code in shortly. In the above code images are being renamed as We also have to think about deleting files, do we delete the corresponding thumbnails too? (- my preference) or is there a case where thumbnails would want to be removed manually? @Brle88, @austintoddj do you guys have any thoughts? |
Well, I kinda wanted to say more about this - I think that the best solution is the wp solution. In large scale, the best way to organize files is by month - 01, 02, 03 etc. I didn't think of this at first, by now I know, it would fix the speed problem, a mentioned in the my feature request previously. As for the naming, well it depends what are your naming conventions - i.e, if you have multiple sizes, then 'thumb-' isn't gonna work, and it's much simpler, to do i.e. 180x145_filename.extension. In my case, I did add a separate thumb folder, just because thumbs should not be manipulated in any way by users, and I've instructed writers on my website not to enter that folder. Also, keeping thumbs in a separate folder makes sense, because in this way you de-clutter the ui. |
was this actually implemented? https://css-tricks.com/responsive-images-youre-just-changing-resolutions-use-srcset/ |
Hi @jossnaz, This hasn't been implemented yet that's why the issue is still open. If you could make a PR with the ideas in the link you've posted it be really grateful! Thanks Talv |
Generating thumbnails for images on upload would be a great feature to optionally enable,
In high volume environments it would be normal for this sort of work to be shipped off to a queue so maybe this is something that needs to be configurable.
I've never actually worked with queues before so im not 100% sure on how to implement this or how we can fall back to getting the current application to handle thumbnail generation on upload.
There also needs to be a way to reference the thumbnail easily within blade/view templates, maybe some sort of helper function.
The text was updated successfully, but these errors were encountered: