Mystery issue with GIF upload?

隐身守侯 提交于 2019-12-08 03:04:11

问题


Alright, so whenever I upload this GIF to my board (NGINX+PHP-FPM) I get a slow down until an eventual 504 Gateway Time-out, alright, so I know what you're thinking, "go ahead and fix those nginx.conf and php-fpm settings", well I tweaked them to near perfection last night, my server is running brilliantly now. However, that one particular GIF still screws up, runs php-FPM to almost 100% (I have a great top of the line quad core processor in my server, my server is by no means primitive).

So want to know where it gets weirder? I've uploaded 10MB GIF's with bigger dimensions than the one in case (the one which is causing the issues is about 600KB) and had the server process them ridiculously quickly.

Alright! So let's get into the log, error_log doesn't output anything in regards to this issue. So I went ahlead and set up a slowlog within the php-FPM config.

Here's the issue: [02-Oct-2011 05:54:17] [pool www] pid 76004 script_filename = /usr/local/www/mydomain/post.php [0x0000000805afc6d8] imagefill() /usr/local/www/mydomain/inc/post.php:159 [0x0000000805afb908] fastImageCopyResampled() /usr/local/www/mydomain/inc/post.php:107 [0x0000000805af4240] createThumbnail() /usr/local/www/mydomain/classes/upload.php:182 [0x0000000805aeb058] HandleUpload() /usr/local/www/mydomain/post.php:235

Okay, let's look at post.php (line 159 in bold): if (preg_match("/png/", $system[0]) || preg_match("/gif/", $system[0])) { $colorcount = imagecolorstotal($src_image); if ($colorcount <= 256 && $colorcount != 0) { imagetruecolortopalette($dst_image,true,$colorcount); imagepalettecopy($dst_image,$src_image); $transparentcolor = imagecolortransparent($src_image); **imagefill($dst_image,0,0,$transparentcolor);** imagecolortransparent($dst_image,$transparentcolor); }

Line 107: fastImageCopyResampled($dst_img, $src_img, 0, 0, 0, 0, $thumb_w, $thumb_h, $old_x, $old_y, $system);

upload.php, line 182 (in bold): **if (!createThumbnail($this->file_location, $this->file_thumb_location, KU_REPLYTHUMBWIDTH, KU_REPLYTHUMBHEIGHT))** { exitWithErrorPage(_gettext('Could not create thumbnail.'));

(note, that error does not show up)

The other post.php (line 235): $upload_class->HandleUpload();

So what can I do? How can I fix this? I know this is a tough issue, but if you guys could give me any input, it would be greatly appreciated.

Oh and in case anyone is curious, here's the GIF: http://i.imgur.com/rmvau.gif


回答1:


Have you tried setting the client_body_buffer_size directive in your nginx configs?

See more here: http://www.lifelinux.com/how-to-optimize-nginx-for-maximum-performance/



来源:https://stackoverflow.com/questions/7626580/mystery-issue-with-gif-upload

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!