Answer the question
In order to leave comments, you need to log in
PHP GD: problem with big pictures?
Hello PHP Experts.
I have a problem, I can not do without your help.
The problem is this:
When uploading a picture to the server, thumbnails (previews) are created, and the original is reduced to a certain size in width. The problem arises when I add high resolution photos (8 megapixels). There is no problem in the weight of the file, it is in the resolution.
Here is a piece of code:
And here is the error itself:
Tell me, please, how can I deal with this problem? Perhaps you need to add something? Or can you tell me, for example, some flash loader that reduces the image on the client side before loading? The client categorically refuses to reduce images before downloading, and I understand him.
Answer the question
In order to leave comments, you need to log in
>Invalid image dimensions
Well, look what your $dst_w and $dst_h are equal to in this case. You didn't provide the code for them.
By the way, as an option, create a preview using ImageMagic. Usually comes out faster and better.
+ to the second comment, and not just create them with Image Magick, but with its CONSOLE version approximately according to the following scheme:
- Get the file in tempo
- Do the necessary renaming, checks, etc.
- We add the original to where it will lie
- we run it through exec () / usr / bun / convert ...;
Actually what's the catch ... and why it's better to do it this way. I once dealt with the uploadify plugin for jquery, which allows you to multi-upload photos. At first I used GD, but on photos over 2 meters this plugin started to go crazy due to the fact that php gd was very slow on such photos (and it was developed and tested PRINCIPALLY on a milimal VDS, so that if it works there, then on a normal one at least on 10 simultaneous users will not fall, for these reasons). In other words, the plugin went crazy due to the fact that it did not receive responses from the server for a long time, which was busy processing photos at that time. In the case of exec () php on the drum how long it will be executed, he launched the command and does not wait for a response, but goes on with his own business.
And another stone towards GD. There is such a word exif. More than a dozen bricks came out of me on this occasion. Face - you will understand) IM does not have this problem)
Good luck!
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question