How to display file size and runtime?

I'm trying to figure out how to display the file size and video run time/duration. I haven't seen a php print function that will make this happen.

Does anyone know how to do this in zenphoto?

Thanks!

Comments

  • File size would be simple--there is a PHP function, `filesize($filename)` for that. There are no Zenphoto functions for run-time. Maybe it is a function of file-size or maybe there is metadata in the file that tells you. But I do not know.
  • acrylian Administrator, Developer
    There is metadata for the video run time if supported by the getID3 class we use. You should get that via the general metadata function if it was able to extract that.
  • And how do i get that info to display? I"ve tried different coding for php but I don't know what to put to get it to display the file size and file name. It needs to go where the 5's are:

    <?php if ($thumbcrop) { printCustomSizedImage(getBareImageTitle(),null,$imagesize,$imagesize,$imagesize,$imagesize,null,null,'remove-attributes',null,true); } else { printCustomSizedImage(getBareImageTitle(),$imagesize,null,null,null,null,null,null,'remove-attributes',null,true); } ?>
    55555555555555555555555555555
  • Thanks for all the helpful info. I'm trying to tell you I don't know how to get the filesize($filename) to display on the page. There has to be some kind of formatting and I can't figure it out.

    For instance, in html, I can't show an image by typing:
    img src="http://www.google.com/1.jpg"

    I have to type:
    <img src="http://www.google.com/1.jpg">

    So how do I get filesize($filename) to display on the page?
  • acrylian Administrator, Developer
    Echo it. Really php basics. You will need to pass the unprotected full image url to get the actual value. See the standard themes for that or the documentation.

    The function I mentioned above are of course very different as they return an array.
  • admittedly, I'm lacking knowledge about how to get this to work.

    I try:
    <?php echo filesize($filename());?>

    but it breaks the page and does not display file size information.

    Any help would be appreciated.
  • Would anyone be interested in showing me how to get the filename, file date, and file size to display in gallery.php and image.php?

    If you want something in exhange, I would be happy to write about your site, product or service on iGotStiffed.com or SillyReviews.com

    Thanks.
  • acrylian Administrator, Developer
    Well, `<?php echo filesize($filename());?>` will of course not work unless you define the variable. But you need the path to the full image. There is an very obvious function called `getFullImageURL`. The full image needs to be set to unprotected.
  • Ok, here are a photo and the code for album.php. The theme is zpskeleton.

    Where you see "5555555" is where I'd like to be able to display the file size in MB and the file name.

    What could I put in place of "55555555" to achieve these results?

    Screenshot: http://imgur.com/kloFO

    album.php code: http://codeviewer.org/view/code:2a8f
  • acrylian Administrator, Developer
    1. `echo filesize(getFullImageURL());`. You might need to do some calculating to get the MB value itself.
    2. `echo $_zp_current_image->filename;`

    I suggest you take some time to learn php basics, for example on http://www.w3schools.com/php/default.asp.

    We have really no resource to teach that here. Sorry.
  • I appreciate your help with this. I have been editing php in Wordpress for many years without as much difficulty as I am finding here. ZenPhoto is absolutely perfect for the application I am using it for (somewhat of a "Tube" site).

    As for your last reply, the filename now shows, but the file size does not. Am I making a mistake?

    `
    <?php if ($thumbcrop) { printCustomSizedImage(getBareImageTitle(),null,$imagesize,$imagesize,$imagesize,$imagesize,null,null,'remove-attributes',null,true); } else { printCustomSizedImage(getBareImageTitle(),$imagesize,null,null,null,null,null,null,'remove-attributes',null,true); } ?><?php echo $_zp_current_image->filename;?>
    <?php echo filesize(getFullImageURL());?>
    `
Sign In or Register to comment.