OneDrive - Wrong size for PNG files - onedrive

When uploading certain PNG files the size is incorrectly reported on the OneDrive website and in the Photo object returned by the REST API. This can be reproduced using the following PNG file:
http://www2.zippyshare.com/v/11270772/file.html
The file size is 20.3 KB, OneDrive displays it as 38.4 KB
It seems this only happens with PNG files that would be downsized/converted when the downsize_photo_uploads query param is absent or set to true. But the problem is not just limited to uploads using the REST API.
The problem has been already been reported here.

Ryan from OneDrive here. We looked into this and have a good understanding of what's going wrong with the size. OneDrive computes the "space" a file takes up in our system by using the size of the largest data stream associated with a file. When an image is uploaded to OneDrive, we also create thumbnails for images so that we can quickly show various views in our clients and website.
In the case of this particular file, one of the JPG thumbnails we create for the PNG file is actually larger than the original file (due to the JPG compression not being as effective as PNG for this image). As a result, the thumbnail is actually the largest stream on the file. As you can imagine, that doesn't happen very often, but for this image (and others like it) we have this bug.
We have a bug tracking the issue and are investigating how we can fix the API to return the size of the "default" stream -- the stream that represents the actual contents of the file. I don't have an ETA for the fix, but we're working on it.

FWIW, I appreciate your post, I discovered that is seems to be the same issue with the Android Onedrive SDK post I made a couple weeks ago
Does OneDrive change/re-encode jpg files?
It doesn't seem like anyone from MS is actually monitoring these SO tags very closely, so I'm creating a Github issue on the Android SDK, maybe that will produce an answer.
https://github.com/liveservices/LiveSDK-for-Android/issues/37

Related

Finding the file size of an image file in the Sony Camera Remote API

I'm writing a fairly involved application for working with Sony cameras.
I can list the contents of the camera and copy image files no problem at all, but I can't seem to figure out the size of the files before I start to download them.
I'm receiving the file list using the standard getContentList API, and finding the files using the originals array in the response. That response seems to have no file size information in it.
Is this possible? Knowing the file size before downloading is important for a good user experience, and all the other camera APIs support it.
I do get the size when I start to download in the HTTP Content-Length header, but performing HEAD requests to hundreds of URLs in a row seems very inefficient!
Unfortunately the API does not support getting the file size.

Count no. of pages in a PDF file while uploading in Javascript

I want to calculate number of pages in a PDF file while uploading to my application by Javascript in Client Side. I want some help for this. I Google this topic but I couldn't get any appropriate solution.
If you are uploading PDF file to the server anyway then it is better to do this on the server-side, there are lot of options depending what is your target platform).
For example, you may use the open source Ghostscript to count total number of pages.

Download chunks of MP4 file from iOS

I am developing an iOS app that synchronises with GoPro cameras.
One of the feature requires downloading MP4 from the GoPro (potentially huge).
I basically have a url like: http://10.9.9.5/whatever/video.mp4.
However, I only need parts of the video, let's say between 1:00 and 1:05.
I am thinking on downloading just parts of the MP4, using HTTP "Range" header. I believe that it's possible and I will get a bunch of bytes.
However, is it a valid file? Will I be able to create a MP4 ? Do I need the MP4 header with meta information? Do any of you faced this kind of challenge?
I am using Objective C but I believe that this is a general question.
The MP4 file is a container for video that is structured around something called boxes. Probably you'll have h.264 video in that MP4 file, knowing that, you'll need to know the structure of the file you are trying to chunk.
Depending on the way it is encoded you'll have to look for a box with metadata that'll allow you to search for the correct part of the file either at the beginning or at the end, but you'll have to reconstruct a valid MP4 with the data you get from the original file.
You can see a reference of the file format here http://xhelmboyx.tripod.com/formats/mp4-layout.txt.

How can I upload large files by chunk, pieces?

I have got a little file sharing webpage. It's free to use it. I would like to upload files between 0mb and 1GB. I'm searching in Google since two days, but I can't find anything what I needed...
My webpage: http://boxy.tigyisolutions.hu However I can upload only 20-30mb now. I would like upload only 1 file at once. But it may be bigger than 500-600mb ... Can anyone help me?
I tried jquery fileupload, but it's uploading nothing for me.
The Blob.slice method will allow you to split up a file client-side into chunks. You must then send each chunk individually. This will only work on browsers that support the File API.
If you don't want to write this code yourself, Fine Uploader is a javascript uploader library that has the ability to chunk files for you and send them to your server.

Twitpic Upload API

Just wondering if there are any rate limits when it comes to uploading images to Twitpic with the API. I find that on the odd occasion the image doesn't upload. Does anyone have any experience with a similar problem or how I might go about fixing it.
Should also have mentioned the images are around 200KB or less.
There is a 10MB image upload limit:
We take GIF, JPG, & PNG images up to 10MB in size, and videos up to 1:30 in length in most formats.
Source: http://twitpic.com/upload
It could also be that their API is having issues, which if that's the case you need to pass the error to the user so they know what happened.