rifanece / timthumb

Automatically exported from code.google.com/p/timthumb
0 stars 0 forks source link

Problem to execute file command #15

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
When I load my picture with timthumb.php, I have an error in my apache logs
but the picture is ok.
ie:

==> /var/log/apache2/access_log <==
www.mywebsite.com 82.243.xxx.xxx - - [26/Jan/2009:01:42:51 +0100] "GET
/wp-content/themes/arthemia/scripts/timthumb.php?src=/wp-content/uploads/2008/11
/dessert1.jpg&w=150&h=150&zc=1&q=100
HTTP/1.1" 200 5773 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0;
Win64; x64; .NET CLR 2.0.50727; SLCC1; .NET CLR 3.0.04506; .NET CLR 3.5.21022)"

==> /var/log/apache2/error_log <==
[Mon Jan 26 01:42:50 2009] [error] [client 82.243.xxx.xxx] Usage: file
[-bcikLhnNrsvz0] [-e test] [-f namefile] [-F separator] [-m magicfiles] file...
[Mon Jan 26 01:42:50 2009] [error] [client 82.243.xxx.xxx]        file -C
-m magicfiles
[Mon Jan 26 01:42:50 2009] [error] [client 82.243.xxx.xxx] Try `file
--help' for more information.

I have changed line 234
$mime_type = trim(@shell_exec('file -bi $file'));
with
$mime_type = trim(@shell_exec('file -bi "$file"'));

and I have no more errors

Original issue reported on code.google.com by grougrou on 26 Jan 2009 at 12:52

GoogleCodeExporter commented 8 years ago
This should be updated in the source. This worked for me as well.

Original comment by fud.thet...@gmail.com on 9 Mar 2009 at 9:02

GoogleCodeExporter commented 8 years ago

Original comment by BinaryMoon on 14 Mar 2009 at 9:28

GoogleCodeExporter commented 8 years ago
@grougrou & @fud.theturtle:
I don't think 'file -bi "$file"' works... $file is still in single quotes. I 
think 
this way you just get rid of the error message and it's still not working as 
intended.

Original comment by hans.sp...@gmail.com on 7 Aug 2009 at 8:58

GoogleCodeExporter commented 8 years ago
I still have this problem.. any fixes? 
Will try your solution, images work me for but that error message is annoying 
and
filled my error_log will 1GB of junk

Original comment by realtime...@googlemail.com on 28 Nov 2009 at 4:04

GoogleCodeExporter commented 8 years ago
The working solution:
$mime_type = trim( @shell_exec( 'file -bi ' . escapeshellcmd( $file ) ) );

Original comment by glenn.an...@gmail.com on 18 Jan 2011 at 8:49