ZenphotoCMS Forum
How to display file size and runtime? - 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: How to display file size and runtime? (/thread-10472.html)



How to display file size and runtime? - nussjunk - 2012-10-04

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!




How to display file size and runtime? - sbillard - 2012-10-04

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.




How to display file size and runtime? - acrylian - 2012-10-05

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.




How to display file size and runtime? - nussjunk - 2012-10-09

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:

55555555555555555555555555555




How to display file size and runtime? - acrylian - 2012-10-10

Please see the documentation:
http://www.zenphoto.org/documentation/functions/_template-functions.php.html#functiongetImageMetaData
http://www.zenphoto.org/documentation/functions/_template-functions.php.html#functionprintImageMetadata




How to display file size and runtime? - nussjunk - 2012-10-10

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:

So how do I get filesize($filename) to display on the page?




How to display file size and runtime? - acrylian - 2012-10-10

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.




How to display file size and runtime? - nussjunk - 2012-10-10

admittedly, I'm lacking knowledge about how to get this to work.

I try:

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

Any help would be appreciated.




How to display file size and runtime? - nussjunk - 2012-10-11

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.




How to display file size and runtime? - acrylian - 2012-10-11

Well, `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 calledgetFullImageURL`. The full image needs to be set to unprotected.




How to display file size and runtime? - nussjunk - 2012-10-12

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




How to display file size and runtime? - acrylian - 2012-10-12

  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.




How to display file size and runtime? - nussjunk - 2012-10-12

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?

`

`