How can I scale down an image to obtain its binary value?

Source: Internet
Author: User
How can I scale down an image to obtain its binary value? Mongodb database Image binary storage

I am using a mongodb database to store images in binary format. The problem is that I have obtained the binary data. how can I scale it down?


Reply to discussion (solution)

$ Im = imagecreatefromstring ('obtained image data ');

There will be nothing special next.

Can imagecreatefromstring () really recognize binary data? Let me try. thank you!

$ Im = imagecreatefromstring ('obtained image data ');

Next, there is nothing special about it. how can we convert the image into a binary format?

This is a bit strange. Aren't you "storing images in binary format? Why?

This is a bit strange. Aren't you "storing images in binary format? Why? This was previously done by a Great God. you can't understand it... What I want to do is to narrow down the binary image and convert it to binary without damaging the original structure... Can you tell me how to implement it? Thank you.

... Image operations
Imagegif ($ im, 'filename ');
$ S = file_get_contents ('filename ');

Or

... Image operations
Ob_start ();
Imagegif ($ im );
$ S = ob_get_clean ();

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.