• I need to display display some image information on post page from featured image of that page. I need:

    image file size (in kb or MB),
    image type (.jpg,.gif…),
    bare image name, with and/or without image extension (some-image-file-name.jpg)

    Maybe it would be helpful if I say that I do not have any image in post content, one, and only image associated with post it is, and will be featured image.

    It would be great to have separate functions to display that info of “medium” and image in “full” size, or at least of “full” size.
    Could you please give me some functions which I can put in my theme files to display that info of featured image?

    Best regards.

Viewing 2 replies - 1 through 2 (of 2 total)
  • I’m not sure if this will answer your question… but I’ll run it up the flagpole.

    When you’re posting an item, if you upload a photo image in via the “add media” function in WP, it tells you the dimensions of the photo and gives you an opportunity to provide a scaled down photo that you can click on and see enlarged.

    When in the editing mode, WP also allows you to create a caption, alt tag and description.

    If you want the dimensions to appear when a visitor or you roll over the photo, then put that data in one of these fields.

    if you want to just be able to look at the dimensions as an editor, just click on the photo after you’ve created the post and it will show it.

    I’m not sure if that answers your question or if there is something different you’re looking for.

    Thanking you.

    Thread Starter Advanced SEO

    (@jole5)

    No, I do not need to see image dimensions (width x height), I know how to get that without manually entering that data in alt field of the image.

    What I need is function (for single.php) that will display image:
    image file size (in kb or MB),
    image type (.jpg,.gif…),
    bare image name, with and/or without image extension (some-image-file-name.jpg)
    on post page when it is viewed by visitor. WP already have some functions to display that info in “Edit Media” screen when you click on image to edit it.
    On right side of that page you can see something like this:
    Uploaded on: ………..
    ?Last modified: ………..
    File URL: ……………………………
    File name: ………..
    File type: …
    File size: …
    Dimensions: … × …

    I need php function which I gen insert in my single.php file to show that info (each separately).
    I already have it for uploaded, modified time (post created, modified time), image URL (for all sizes of image separately), dimensions (for all sizes of image separately).

    So, what I still need is function to show: file name, file type, file size.

    Any help?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to display image file size, extension, name, type?’ is closed to new replies.