Show file name via PHP in theme

Hi there,

1. I need the file name of the image:
I'm just trying to add an option in "image.php" that shows me the actual file name of the current image. Something like <?php echo getBareImageTitle();?> or <?php echo getFullImageURL();?> simply doesn't work. For example: If File name is DSC00001.JPG I want to get that title using a PHP tag. Or even better just the file name without the file extension: "DSC00001".

2. I need the folder name that the current image contains e.g. "Album1" as an PHP tag.

Is that possible somehow?

My final idea: I want to add a link to the original picture in full size packed as ZIP file. The ZIP file is in the same folder and if I'm just on the DSC00001.JPG "image.php" it adds the link to "Album1/DSC00001.ZIP"

It is probably just like switching off the "hotlink_protection" ... I guess.

Best wishes!

Andy

Comments

  • acrylian Administrator, Developer
    A good idea is always to look at the user guide and the functions documentation:

    1. `$_zp_current_image->filename`
    2. `$_zp_current_album->name`
  • Sorry I'm not into PHP: How should I add the tags ... like:
    <?php echo $_zp_current_image ?>
    <?php echo $_zp_current_album ?>

    Doesn't work ...
  • acrylian Administrator, Developer
    Sorry I'm not into PHP
    Then you should learn at least the basics before doing custom theme stuff. You will run into more trouble sooner or later.

    Of course that does not work....Those variables can't be echoed directly as they are objects. Also you did apparently not read what I wrote.
  • Thanks for the link, man!

    <?php echo getUnprotectedImageURL(); ?>

    Works quite well!!!
    You see even with no PHP knowledge things work out.

    G'day.
  • acrylian Administrator, Developer
    Sure, but learning some PHP basics is always a good idea (believe me I started that way).
  • I was able to do like this: <? $url = "http://".$_SERVER['HTTP_HOST']; echo $url ?><?php echo getUnprotectedImageURL(); ?>.zip
  • acrylian Administrator, Developer
    Ok, that would probably work but we have already a constant WEBPATH or FULLWEBPATH for that http host stuff.
Sign In or Register to comment.