(Untitled)

Hi!

I currently have my own little photo album and am planning on moving over to zenphoto.

Right now I have everything set up and running, but I need a way to get the filename. On each image page I want to grab more data about the image that I already have stored in another MySQL table. To grab the correct information I need to be able top grab the filename of the image that is being shown, add a bit of text to it so it will match the thumb address of the second table and then call in the required fields.

The problem I am having is figuing out how to grab the filename of the image.

Thank you much for your time!
-Mr. Dobolina, Mr. Bob Dobolina

Comments

  • trisweb Administrator
    From a theme, it's in the following variable for the current image (whether you're on the image page, or in the `while(next_image):` loop).

    `$_zp_current_image->name`

    If you need it for some other image, take a look at the gallery, album and image classes in classes.php and the things that return images. You can get any of those and get their name or do anything else you want with them :)
  • Ok,
    <? echo '$_zp_current_image->name' ?>
    works.

    It echoes filename.jpg on the image page.

    But how to strip the extension .jpg and display the filename on an image page?
  • trisweb Administrator
    That is the filename...

    If you want to strip the extension, try
    `<?php echo substr($_zp_current_image->name, 0, strrpos($_zp_current_image->name, '.')); ?>`
  • Thanks Tristan. It works.
  • trisweb Administrator
    Cool, no problem.
  • This is an old thread so wondering if this still works? I tried putting

    <?php echo substr($_zp_current_image->name, 0, strrpos($_zp_current_image->name, '.')); ?>

    in the h2 tag but it is blank on page

    Also tried it in page title but still blank
  • found a post that said you changed name to filename, it works now ;-)
  • Another question, does getFileName function exist? or printFileName? If not, how can it be done?
  • acrylian Administrator, Developer
    Yes, see the documentation.
Sign In or Register to comment.