I'm wondering how to get file sizes for these file formats pdf, imag, mp3, zip, video and maybe for video and audio files is there is a way to get the duration and dimensions ???
@SERGIU17 - thank you, i know about php fileSize() i was wondering if there is a way to do the same in laravel? the filesize php function will not get you the mp3 file duration neither video dimensions
I don't think there is any native way to get that information. You might be able to find some 3rd party package that does this.
One thing you could consider is grabbing the output of a utility such as ffmpeg. You wouldn't need to worry about accounting for all the different audio/video file formats, as it supports many.
Here are a couple threads demonstrating how you might go about it:
@nhayder You can use FFMpeg to get video lengths, frame dimensions, audio lengths, etc., in addition to being able to convert files between just about any format.
If you find one, let me know! One of my projects does a heck of a lot of audio/video conversion. I haven't found anything that is nearly as powerful or has all of the needed features and keeps up with newer codecs, which are coming out all of the time. It's definitely a swiss army knife kind of tool. Those are always pretty complicated with lots of options, most of which you'll never use. The actual app is a commandline tool. There are a lot of php (and other language) wrappers for it, but it's a binary under the hood. You could just use exec() and manually use the CLI tool. That's basically all the wrappers are doing.