![]() |
|
Remove date from image title display - 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: Remove date from image title display (/thread-1678.html) |
Remove date from image title display - DiFFeReNT - 2007-10-01 I'm migrating from another gallery script where I created my own public image upload form. To prevent images with duplicate names from being uploaded, the upload script automatically added "date_" to the filename when saving it. I want to keep the image names the way they are, and to keep using my upload form so the pubic (private website) can continue uploading images. However, I want zenphoto to exclude the "date_" from the filename when displaying it. I'm trying to implement this script in there to remove only read what's after the underscore:
When implementing this, it would be great to not have to replace every "``" in all the zenphoto files... In order to accomplish that, it appears I need to use this with the getImageTitle() function on line 430 of template-functions.php, but I'm not sure exactly how it should be used. Actual code before changes: function getImageTitle() { if(!in_context(ZP_IMAGE)) return false; global $_zp_current_image; return $_zp_current_image->getTitle(); } ` Here's my guess. Code with my changes: function getImageTitle() { if(!in_context(ZP_IMAGE)) return false; global $_zp_current_image; $new-filename = substr(strrchr('$_zp_currentimage, ""), 1); return $new-filename->getTitle(); } ` Thanks in advance for your help! Remove date from image title display - acrylian - 2007-10-01 I would suggest not to hack the template-functions because you have do do it again everytime you update zenphoto. There are not that much getImageTitle functions on the 3 standard theme files (how much do you have??) Remove date from image title display - DiFFeReNT - 2007-10-01 I didn't want to touch the functions anyway... There's not many getImageTitle functions on my theme either, however when searching the zenphoto directory there was like a thousand... I guess those aren't being displayed anywhere then. That looks promising, I'll try it out (except the 15 part - only a few images start with IMG or DSC). Also, thanks for the .jpg part, I hadn't really thought about doing that. Remove date from image title display - sbillard - 2007-10-01 Why don't you just make a `function getImageTitleStripped() { $imgname = substr(strrchr(getImageTitle(), "_"), 1); return $imgname; }` Or, with the change comming up in the SVN, you could just edit the IPTC data in your images to put the title you want displayed in the heading tag. Then it does not matter what the name of the file is. Remove date from image title display - DiFFeReNT - 2007-10-01 I tried both of your suggestions with no success, and then I realized, I have to clear the cache don't I? Tries that, at least with one image, still doesn't work. Maybe I have to delete the image completely.. that didn't work either... Everything still works, but nothing changes in the filenames... Editing meta data would be a nice solution, except theres 600+ pictures, and people still add pictures. Remove date from image title display - aitf311 - 2007-10-02 No, you should not have to delete your cache. Remove date from image title display - DiFFeReNT - 2007-10-02 I'm stumped. There is no effect, period. Thanks for your help Remove date from image title display - sbillard - 2007-10-05 Sounds like you need to find where the image name is being shown. If you replaced that code with the new function it would show a different name. Remove date from image title display - DiFFeReNT - 2007-10-05 After taking a break from this for a few days, I was responding to your message (sbillard) and getting code to quote, when I realized why it wasn't working. Simple answer: I created my own getImageTitle function with the modifications: function getImageTitle() { if(!in_context(ZP_IMAGE)) return false; global $_zp_current_image; return $_zp_current_image->getTitle(); } function getImageTitleStripped() { //mine
} ` So I created a function for that: function printImageTitle($editable=false) { global $_zp_current_image; if ($editable && zp_loggedin()) {
} else {
} } function printImageTitleStripped($editable=false) { //mine global $_zp_current_image; $imageName = substr(getImageTitle(true),11); if ($editable && zp_loggedin()) {
} else {
} } ` Thanks for all your help! Remove date from image title display - sbillard - 2007-10-05 Glad you have this straightened out. |