ZenphotoCMS Forum
Display image size (pixels and bytes) in admin edit images area - Printable Version

+- ZenphotoCMS Forum (https://forum.zenphoto.org)
+-- Forum: Support (https://forum.zenphoto.org/forum-1.html)
+--- Forum: General support (https://forum.zenphoto.org/forum-4.html)
+--- Thread: Display image size (pixels and bytes) in admin edit images area (/thread-4161.html)



Display image size (pixels and bytes) in admin edit images area - avicarmi - 2008-12-02

Hi,

my first post, tried to search but did not find anything, so here we go.

Is there an easy way to add the size of the images (pixels and bytes) in the admin area where you edit the image title, description, etc?

I might be able to dig into the PHP code and attempt to add this myself, however, if someone already know how to do it, any help will be greatly appreciates.

Thanks for a great program,

-avi




Display image size (pixels and bytes) in admin edit images area - avicarmi - 2008-12-02

Answering my own question:

Here is how I added the image size and file size to the admin area:

  1. in admin.php after line 719 (or whereever you want to display the info) add the following:

`

Image size: 
 W x  H


File size:

`
2) at bottom of functions.php (before the final ?> add the following:

`
/** avc

  • Parses a byte size from a size value (eg: 100M).
    */
    function byteConvert( $bytes ) {

    if ($bytes10^x|1024->2^x]
    $s=array('Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB');
    $e=floor(log($bytes,$convention));
    return round($bytes/pow($convention,$e),2).' '.$s[$e];
    }
    `

  1. in class-image.php after getFileName() line 134 add:

`
/** avc

  • Returns The full SERVER path to the original image
  • @return string
    */
    function getLocalPath() {
    return $this->localpath;
    }
    `
    Hope this helps.

-avi




Display image size (pixels and bytes) in admin edit images area - acrylian - 2008-12-02

It is actually not recommended to hack any core files since you will loose this with every update. But this is probably not a bad idea to have on the admin pages. You could create a ticket for that and attach the code there then we might add that in one of the future versions.