Support » Plugin: Media Library Assistant » Trouble Adding Custom Fields

  • Resolved crystalsherrah

    (@crystalsherrah)


    Trying to figure out how to add two custom fields and have them show up on the “assistant” view in the media library. This is a very large plugin with lots of information and I am finding it difficult to take in all the information.

    I would like to be able to see the file size and the file type from the “assistant” section in the media library. I have added file size and clicked execute and waited for the process to complete but It is not showing up can you please help me?

    My settings are:
    Quick edit: file_size
    Data Source: size_pixels
    Meta/templte: file_size
    MLA column: Box Checked, Quick edit: box unchecked, Bulk edit: box unchecked
    Existing text: Keep
    Format: Native
    Option: Text
    Delete NULL Values: box unchecked
    Status: active

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author David Lingren

    (@dglingren)

    Thanks for your question and for providing the details on your rule settings; very helpful. I know that MLA has a lot of features and it can be challenging to find the solution to a specific need.

    You wrote “I would like to be able to see the file size and the file type“. I am not sure what you mean by “file type”, but you can see the MIME Type for any item with a standard MLA column. Click on the “Screen Options” control in Media/Assistant admin screen and check the box next to “MIME Type”. That will display values such as “image/jpeg” for your JPG items. If you want to see the file extension information you can click on the “Base File” entry.

    For the “file size”, size_pixels may not be the best choice. If you want the number of pixels in the full size version of an image file you should pick “pixels” for your data source. If you want the number of bytes in the file itself, try “file_size” for your data source.

    In your settings the “Meta/Template” value is not used; it only applies when the “Data Source” is “Metadata” or “Template”.

    You wrote “it is not showing up“. Does that mean the column is not displayed in the table or that the values for each item are blank/empty?

    For your “file_size” rule I would try the following settings:

    Quick edit: file_size
    Data Source: file_size
    Meta/templte: (leave blank)
    MLA column: Box Checked, Quick edit: box unchecked, Bulk edit: box unchecked
    Existing text: Replace
    Format: Native
    Option: Text
    Delete NULL Values: box checked
    Status: active
    

    Then, click the “Execute” rollover action for your rule to re-map the values for your items.

    If you don’t see the “file_size” column in the Media/Assistant submenu table pull down the “Screen Options” area and make sure that “file_size” is listed and the box next to it is checked.

    I hope that gets you closer to your goal. I will leave this topic unresolved in case you have problems or further questions regarding the above suggestions. Thanks for your interest in the plugin.

    Thank you very much for your help and understanding. The instructions were very clear and I was able to figure it out. When I looked in “screen options” the custom name that I added was there so I checked the box and then fixed the properties of the value and it works fine now. Thank you for the fast reply!

    I also realized that the “file_size” is displayed in bytes.

    My only other question would be is it possible/easy to have it display in kilobytes or megabytes instead of bytes?

    Plugin Author David Lingren

    (@dglingren)

    Thanks for your update with the kind words and good news.

    You can change the way file size is displayed by changing your rule to use the kbmb() option/format function in a Content Template. Here is the description of the function in the “Field-level option/format values” section of the Settings/Media Library Assistant Documentation tab:

    ,kbmb(t,k,m,p) – Some data values, e.g., file size, are better expressed in kilobytes and megabytes. The “kbmb” format provides this conversion. There are four optional arguments; “t” (threshold), “k” (kilobyte suffix), “m” (megabyte suffix) and “p” (precision). The threshold argument (default 10240; ten kilobytes) sets the dividing amount between bytes and kilobytes. For example, a value of 1536 bytes would display as “1,536”, not “1.50 KB” and 15360 bytes would display as “15.5 KB”. The “k” and “m” arguments replace the default ” KB” and/or ” MB” suffix displayed following the numeric value. The “p” argument is the number of decimal places in the result, e.g., a value of 287,709 with a threshold of 1024 displays as “281”, “281.0”, “280.97”, “280.966”, or “280.9658” for precisions 0, 1, 2, 3 and 4.

    For your application, change the “Data Source” value to “— Template (see below) —” and enter [+file_size,kbmb+] in the Meta/Template text box. If you want to change the suffix values and the precision you could enter something like [+file_size,kbmb(10240,Kb,Mb,2)+].

    I hope that gives you the results you need. I am marking this topic resolved, but please update it if you have any problems or further questions regarding the above suggestions.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Trouble Adding Custom Fields’ is closed to new replies.