Giter Site home page Giter Site logo

media too large about macaw-enyo HOT 7 OPEN

rillian avatar rillian commented on July 30, 2024
media too large

from macaw-enyo.

Comments (7)

rillian avatar rillian commented on July 30, 2024

"Media uploads for images are limited to 5MB in file size, and for videos are limited to 15MB. For chunked uploads, the maximum chunk size is 5MB." -- https://dev.twitter.com/rest/reference/post/media/upload

So macaw might be over the limit if it's sending base64 media_data.

from macaw-enyo.

minego avatar minego commented on July 30, 2024

The wording of
https://dev.twitter.com/rest/reference/post/media/upload-chunked implies
that even a chunked image has a total maximum size of 5MB. I'm not sure
if I am reading that correctly though.

On 08/19/15 15:50, Ralph Giles wrote:

"Media uploads for images are limited to 5MB in file size, and for
videos are limited to 15MB. For chunked uploads, the maximum chunk size
is 5MB." -- https://dev.twitter.com/rest/reference/post/media/upload

So macaw might be over the limit if it's sending base64 |media_data| and
not chunking.


Reply to this email directly or view it on GitHub
#76 (comment).

from macaw-enyo.

rillian avatar rillian commented on July 30, 2024

Yes, I think you're right. Presumedly that's per-image. Maybe 5MB < 4.4MB because of inconsistent units?

from macaw-enyo.

minego avatar minego commented on July 30, 2024

On 08/19/15 15:57, Ralph Giles wrote:

Yes, I think you're right. Presumedly that's per-image. Maybe 5MB <
4.4MB because of inconsistent units?


Reply to this email directly or view it on GitHub
#76 (comment).

That seems likely to me.

I suspect that twitter wants the client to resize the image before
sending it. I'm not sure how I can do that in this case. This may take
some experimentation.

from macaw-enyo.

rillian avatar rillian commented on July 30, 2024

I suppose you can draw it into a hidden canvas element? How does the thumbnailing work?

https://hacks.mozilla.org/2011/01/how-to-develop-a-html5-image-uploader/

canvas.toBlob() looks like the most efficient interface for getting the new jpeg data for upload.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob

from macaw-enyo.

minego avatar minego commented on July 30, 2024

That is basically what the thumbnail does. That is a possibility but it
doesn't give me a great deal of control over the final size.
On Aug 20, 2015 7:53 AM, "Ralph Giles" [email protected] wrote:

I suppose you can draw it into a hidden canvas element? How does the
thumbnailing work?

https://hacks.mozilla.org/2011/01/how-to-develop-a-html5-image-uploader/

canvas.toBlob() looks like the most efficient interface for getting the
new jpeg data for upload.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob


Reply to this email directly or view it on GitHub
#76 (comment).

from macaw-enyo.

rillian avatar rillian commented on July 30, 2024

Media in my timeline on the website is all scaled to 600px width. So if you downsample to 1280 (or even 1920) as a maximum dimension it should be considerably smaller that 5MB as a jpeg and still display with reasonable quality.

Maybe do a loop to explore a few options. Try converting png to png, jpeg to jpeg. If the result is too large (Blob.size) try again with a lower jpeg quality, or with jpeg instead of png, or halve the dimensions.

from macaw-enyo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.