Is there a way to display the image size in the directory?
Thanks for the question – the short answer is yes! First, though, you need to choose between three different definitions of “image size”. The first,
file_size, is how much storage the image requires, e.g., 125,000 bytes. The second,
dimensions, is the width and height of the image, e.g., 1024×768 pixels. Finally,
pixelsis the size in pixels rather than bytes, e.g., 786,432 for a 1024×768 image. All of these are available to you.
Columns in the Media/Assistant submenu table, or directory, come from the WordPress database. Attachments have a lot of information, such as image size and file size, that isn’t available in the standard database tables. You can pick from 53 of these additional fields and make them available by mapping them to custom fields. Here’s how it works:
- From the admin Dashboard, scroll down to the Settings section and click the Media Library Assistant entry to open the Settings/Media Library Assistant screen
- Click the Custom Fields tab; have a look through the instructions at the top of the screen
- Scroll down to the “Add a new Custom Field and Mapping Rule” area
- Enter a name for your new field, e.g., “Image Size”, in the first text box
- Pull down the Data Source list next to the text box. Select the data you want; probably
- Since this is a new field, you can leave the “Existing Text” field set to “Replace”
- If you picked
dimensions, use the
Nativeformat. If you picked
pixels), you probably want the
commasformat to make the column sort sensibly
- Check the “MLA Column” box, first one to the right of “Format”. This adds the field to your directory
- Click the “Add Field and Map All Attachments” button just below the field name text box.
- Wait a few moments for the field to be set up and all the data filled in
- Go back to the Media/Assistant submenu. Your new column should appear on the right-hand side of the directory. Click on the column header to sort on this field.
There is another checkbox at the top of the Custom Fields tab, “Enable custom field mapping when adding new media”. If you leave this box checked (the default), your custom field will automatically be created for any items added to the Media Library after you created the rule.
If the above process is unclear or if you have any trouble, let me know. You can find more information in the Documentation tab on the Settings page; look for “Custom Field Processing Options” and “Data Sources for custom field mapping” in the list of section heading links at the top of the screen.
I hope that gets you started on adding the information you need to the directory. Thanks for using the plugin.
- The topic ‘Show Image Size in Directory?’ is closed to new replies.