Displaying image information in file panel

You want to talk about Far Manager, but don't know where to turn?
User avatar
buniak_a_h
Posts: 4261
Joined: Sat 20 Apr, 2013 00:17
Location: Санкт-Петробад
Has thanked: 222 times
Been thanked: 644 times
Contact:

Displaying image information in file panel

Post by buniak_a_h »

Latest post of the previous page:

2useven10 wrote: Thu 06 Oct, 2022 15:59 It is too optimistic suppose that parameters are mandatory in any picture.
And what about Width and Height parameters?
2useven10
Posts: 5226
Joined: Mon 07 Sep, 2009 10:40
Has thanked: 18 times
Been thanked: 314 times

Displaying image information in file panel

Post by 2useven10 »

That is much more realistic.
old_gregg
Posts: 46
Joined: Fri 01 May, 2015 16:04
Has thanked: 10 times
Been thanked: 1 time

Displaying image information in file panel

Post by old_gregg »

No, it's not working.
old_gregg
Posts: 46
Joined: Fri 01 May, 2015 16:04
Has thanked: 10 times
Been thanked: 1 time

Displaying image information in file panel

Post by old_gregg »

If I replace the last line in the function with this:

Code: Select all

if ok then return 'hello' end --return Vals[1]..'x'..Vals[2] end
I still don't get anything. The column is still blank.
Last edited by old_gregg on Thu 06 Oct, 2022 16:21, edited 1 time in total.
old_gregg
Posts: 46
Joined: Fri 01 May, 2015 16:04
Has thanked: 10 times
Been thanked: 1 time

Displaying image information in file panel

Post by old_gregg »

So my script looks like this:
  1.     local MediaInfo_GUID = '919C1FC6-A571-4642-99DF-BDACE840ED18'
  2.  
  3.     local function GetPicSize(FilePath)
  4.  
  5.       local ok,n,_,Vals=Plugin.SyncCall(MediaInfo_GUID, FilePath,'{Width,Height}')
  6.  
  7.       if ok and n == 2 then
  8.  
  9.         Vals[1], Vals[2] = (Vals[1]:match"^([%d%s]*) pixels$" or ''):gsub("%s",''), (Vals[2]:match"^([%d%s]*) pixels$" or ''):gsub("%s",'')
  10.  
  11.         ok = not not (Vals[1] and Vals[2])
  12.  
  13.         if ok then return 'hello' end --return Vals[1]..'x'..Vals[2] end
  14.  
  15.       end
  16.  
  17.     end
  18.  
  19.     ContentColumns {
  20.  
  21.       filemask = "*.webp,*.bmp,*.gif,*.jpg,*.png,*.psd,*.jpe,*.jpeg,*.cdr,*.wmf,*.ai,*.cmx,*.svg,*.emf,*.ico,*.icl,*.cur,*.ani,*.dds,*.tif,*.tiff,*.tga,*.pcx,*.pic,*.jpc,*.jp2,*.j2k,*.mng,*.psp,*.xbm,*.xpm,*.dib,*.rle,*.lbm,*.iff,*.pbm,*.pgm,*.ppm,*.ras,*.sgi,*.rgb,*.bw,*.wbmp,*.dcx,*.cel,*.flc,*.fli,*.spr,*.fpx";
  22.  
  23.       GetContentFields = function(ColNames)
  24.  
  25.         for j,v in ipairs(ColNames) do
  26.  
  27.           if v:lower()=="size" then return true end
  28.  
  29.         end
  30.  
  31.       end;
  32.  
  33.       GetContentData = function(FilePath,ColNames)
  34.  
  35.         local data = {}
  36.  
  37.         for j,v in ipairs(ColNames) do
  38.  
  39.           if v:lower() == 'size' then
  40.  
  41.             local PicSize = GetPicSize(FilePath)
  42.  
  43.             data[j] = PicSize or ''
  44.  
  45.           end
  46.  
  47.         end
  48.  
  49.         return next(data) and data
  50.  
  51.       end;
  52.  
  53.     }
Last edited by old_gregg on Thu 06 Oct, 2022 16:20, edited 1 time in total.
old_gregg
Posts: 46
Joined: Fri 01 May, 2015 16:04
Has thanked: 10 times
Been thanked: 1 time

Displaying image information in file panel

Post by old_gregg »

When I replace GetPicSize() with this, I get a string of uh-oh's:
  1. local function GetPicSize(FilePath)
  2.  
  3.   local ok,n,_,Vals=Plugin.SyncCall(MediaInfo_GUID, FilePath,'{Exif.Photo.PixelXDimension,Exif.Photo.PixelYDimension}')
  4.  
  5.   if not ok then
  6.  
  7.       return 'uh-oh'
  8.  
  9.   end
  10.  
  11.   if n == 1 then
  12.  
  13.       return Vals[1]
  14.  
  15.   end
  16.  
  17.   return Vals[1]..'x'..Vals[2]
  18.  
  19. end
Last edited by old_gregg on Thu 06 Oct, 2022 16:27, edited 1 time in total.
User avatar
buniak_a_h
Posts: 4261
Joined: Sat 20 Apr, 2013 00:17
Location: Санкт-Петробад
Has thanked: 222 times
Been thanked: 644 times
Contact:

Displaying image information in file panel

Post by buniak_a_h »

This script works on my files. I don't understand…
Try this:

Code: Select all

local MediaInfo_GUID = '919C1FC6-A571-4642-99DF-BDACE840ED18'
local function GetPicSize(FilePath)
  local ok,n,_,Vals=Plugin.SyncCall(MediaInfo_GUID, FilePath,'{Width,Height}')
  return 'ok='..tostring(ok)..'; n='..tostring(n)..'; '..tostring(Vals[1])..', '..tostring(Vals[2])
end
ContentColumns {
  filemask = "*.webp,*.bmp,*.gif,*.jpg,*.png,*.psd,*.jpe,*.jpeg,*.cdr,*.wmf,*.ai,*.cmx,*.svg,*.emf,*.ico,*.icl,*.cur,*.ani,*.dds,*.tif,*.tiff,*.tga,*.pcx,*.pic,*.jpc,*.jp2,*.j2k,*.mng,*.psp,*.xbm,*.xpm,*.dib,*.rle,*.lbm,*.iff,*.pbm,*.pgm,*.ppm,*.ras,*.sgi,*.rgb,*.bw,*.wbmp,*.dcx,*.cel,*.flc,*.fli,*.spr,*.fpx";
  GetContentFields = function(ColNames)
    for j,v in ipairs(ColNames) do
      if v:lower()=="size" then return true end
    end
  end;
  GetContentData = function(FilePath,ColNames)
    local data = {}
    for j,v in ipairs(ColNames) do
      if v:lower() == 'size' then
        local PicSize = GetPicSize(FilePath)
        data[j] = PicSize or ''
      end
    end
    return next(data) and data
  end;
}
and write me, what you see
2useven10
Posts: 5226
Joined: Mon 07 Sep, 2009 10:40
Has thanked: 18 times
Been thanked: 314 times

Displaying image information in file panel

Post by 2useven10 »

local ok,n,_,Vals=Plugin.SyncCall(MediaInfo_GUID, FilePath,'{Width,Height}') if ok and n == 2 then return Vals[1]:gsub('[%s%a]','') .. 'x' .. Vals[2]:gsub('[%s%a]','') end
Last edited by 2useven10 on Thu 06 Oct, 2022 17:43, edited 1 time in total.
old_gregg
Posts: 46
Joined: Fri 01 May, 2015 16:04
Has thanked: 10 times
Been thanked: 1 time

Displaying image information in file panel

Post by old_gregg »

I get an error:
FarManagerPictureColumnsError.jpg
User avatar
buniak_a_h
Posts: 4261
Joined: Sat 20 Apr, 2013 00:17
Location: Санкт-Петробад
Has thanked: 222 times
Been thanked: 644 times
Contact:

Displaying image information in file panel

Post by buniak_a_h »

2useven10 wrote: Thu 06 Oct, 2022 17:28 Vals[1]:gsub('[%s%a]','') .. 'x' .. Vals[2]:gsub('[%s%a]','')
Even easier:
Vals[1]:gsub("%D",''), Vals[2]:gsub("%D",'')
User avatar
buniak_a_h
Posts: 4261
Joined: Sat 20 Apr, 2013 00:17
Location: Санкт-Петробад
Has thanked: 222 times
Been thanked: 644 times
Contact:

Displaying image information in file panel

Post by buniak_a_h »

old_gregg,
It means that plugin not returns value.
Try set cursor to picture file and typing command:
lua:require"le"{Plugin.SyncCall('919C1FC6-A571-4642-99DF-BDACE840ED18', APanel.Current,"{Width,Height}")}
You should get this:
╔═══════════════════════════════ (4) ═══════════════════════════════╗ ║≡ 0x00000003 (3) │table │table: 0x016191a019a8 ║ ║≡ 0x00000004 (4) │table │table: 0x016191b41fb8 ║ ║ 0x00000001 (1) │boolean │true ║ ║ 0x00000002 (2) │number │0x00000002 (2) ║ ╚══════════════════════ F1, F3, F4, Del, Ctrl+M ══════════════════════╝
Enter on (3):
╔══════════════════════════════ 3 (4) ═══════════════════════════════╗ ║ n │number │0x00000002 (2) ║ ║ 0x00000001 (1) │string │Width ║ ║ 0x00000002 (2) │string │Height ║ ║ type │string │array ║ ╚══════════════════════ F1, F3, F4, Del, Ctrl+M ══════════════════════╝
Esc, Enter on (4):
╔══════════════════════════════ 4 (4) ═══════════════════════════════╗ ║ n │number │0x00000002 (2) ║ ║ 0x00000001 (1) │string │1 125 pixels ║ ║ 0x00000002 (2) │string │2 436 pixels ║ ║ type │string │array ║ ╚══════════════════════ F1, F3, F4, Del, Ctrl+M ══════════════════════╝
Attention!
There should be a file le.lua in the folder %farprofile%\macros\modules!!!
Last edited by buniak_a_h on Thu 06 Oct, 2022 18:15, edited 1 time in total.
old_gregg
Posts: 46
Joined: Fri 01 May, 2015 16:04
Has thanked: 10 times
Been thanked: 1 time

Displaying image information in file panel

Post by old_gregg »

Ok, I don't get that. I just get this:
LELuaOutput.jpg
2useven10
Posts: 5226
Joined: Mon 07 Sep, 2009 10:40
Has thanked: 18 times
Been thanked: 314 times

Displaying image information in file panel

Post by 2useven10 »

old_gregg, What is your MediaInfo plugin version?
Plugring version is obsolette. You should download SourceForge latest version.
2useven10
Posts: 5226
Joined: Mon 07 Sep, 2009 10:40
Has thanked: 18 times
Been thanked: 314 times

Displaying image information in file panel

Post by 2useven10 »

You can see plugin version when press F3 on required plugin item in Plugin commands menu (F11).
User avatar
buniak_a_h
Posts: 4261
Joined: Sat 20 Apr, 2013 00:17
Location: Санкт-Петробад
Has thanked: 222 times
Been thanked: 644 times
Contact:

Displaying image information in file panel

Post by buniak_a_h »

2useven10, I was also thinking about the version number ;-
Post Reply

Return to “General Discussions”