![]() PS: The uploads folder should be in the current directory as of the your script. Convert Image to binary stream Ask Question Asked 9 years, 4 months ago Modified 8 years, 8 months ago Viewed 12k times 0 There are two sides to my app, on one side I'm using C++ in order to read the frames from a camera using Pleora's EBUS SDK. png file extension and the image/png MIME media. from flask import sendfile app.route ('/getimage') def getimage (): filename 'uploads\\123.jpg' return sendfile (filename, mimetype'image/jpg') uploads is my folder name where my image with 123.jpg is present. Portable Network Graphics is a raster-graphics file format that supports lossless data. ![]() fileinfo only looks at the first kilobyte or two of data, so if it says it's not an MP3, it might very well be lying because the data started slightly farther in. The below code helps to send image through. The size of the frame varies based on bitrate and sampling rate, so you can't just grab the bitrate/sample rate of the first frame and assume all the other frames will be the same size - a VBR mp3 must be parsed in its entirety to calculate the total playing time.Īll this boils down to that identifying an MP3 by using PHP's fileinfo and the like isn't reliable, as the actual MP3 data can start ANYWHERE in a file. A frame is the smallest unit of valid MP3 data possible, and represents (going off memory) 0.028 seconds of audio. ![]() The only way to detect them reliably is to parse slowly through the file and try to find something that looks like an MP3 frame. You can embed an MP3 essentially within any file. There can be an ID3v2 header at the start of the file. MP3 files are a strange beast when it comes to identifying them.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |