开发者

Mystery issue with GIF upload?

开发者 https://www.devze.com 2023-04-10 06:06 出处:网络
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.co

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


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/

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号