File names of images used as titles?
Permalink Browser Info Environment
Jordan,
is there a way to automatically make the filenames of images become their titles? It's not very comfortable to copy the filenames of hundreds of images into the title field of the backend form by hand... so i would love to get this job done automatically.
There are two questions i have:
1.) Is it possible to modify the behaviour of the backend form for titles and captures without touching the add-on's core code? In other words, do custom templates also work for the backend of an add-on?
2) What file would have to be modified to have the title fields in the backend filled with the filenames of the images by default?
Maybe the elements/properties_form.php?
Since there is a directory named "elements" at the installation root, i thought it would be possible to overrule the default behaviour of an add-on... is that right?
Thanks in advance,
Michael
is there a way to automatically make the filenames of images become their titles? It's not very comfortable to copy the filenames of hundreds of images into the title field of the backend form by hand... so i would love to get this job done automatically.
There are two questions i have:
1.) Is it possible to modify the behaviour of the backend form for titles and captures without touching the add-on's core code? In other words, do custom templates also work for the backend of an add-on?
2) What file would have to be modified to have the title fields in the backend filled with the filenames of the images by default?
Maybe the elements/properties_form.php?
Since there is a directory named "elements" at the installation root, i thought it would be possible to overrule the default behaviour of an add-on... is that right?
Thanks in advance,
Michael
Type: | Discussion |
---|---|
Status: | New |
Hi Jordan,
again you helped me very much, thank you!
I see the problem: for me, the old behaviour as default may be great, but others maybe wouldn't want to have no titles at all, so they would have to remove them manually or hack the package.
Wouldn't it be a nice solution to implement a function to select that behaviour via a checkbox in the backend form "Titles & Captions", saying for example: "set filenames to titles"?
Thank you for your support!
Michael
again you helped me very much, thank you!
I see the problem: for me, the old behaviour as default may be great, but others maybe wouldn't want to have no titles at all, so they would have to remove them manually or hack the package.
Wouldn't it be a nice solution to implement a function to select that behaviour via a checkbox in the backend form "Titles & Captions", saying for example: "set filenames to titles"?
Thank you for your support!
Michael
Well the problem isn't that it's a bad idea, but rather that the more options there are, the more difficult it is for people to use. Finding the right balance of simplicity vs. flexibility is challenging, and if this becomes something that more people ask for I'll certainly consider adding an option for it.
Otherwise, I'll probably make a site config setting, because those seem to fit better in situations where a feature is only used by a very small proportion of people (because you don't even need to know it exists unless you specifically ask for it, and then it's just a simple config entry to enable it). The downside of that is it becomes a global setting that is applied across the entire site and can't be turned on/off on a per-block basis, but such is the nature of design -- always a series of tradeoffs.
Thanks for your excellent input, it is much appreciated.
-Jordan
Otherwise, I'll probably make a site config setting, because those seem to fit better in situations where a feature is only used by a very small proportion of people (because you don't even need to know it exists unless you specifically ask for it, and then it's just a simple config entry to enable it). The downside of that is it becomes a global setting that is applied across the entire site and can't be turned on/off on a per-block basis, but such is the nature of design -- always a series of tradeoffs.
Thanks for your excellent input, it is much appreciated.
-Jordan
Thank you for pointing this out, of course i agree with you, it's a balancing act 'features versus simplicity', but i have to admit, that personally, i love features & flexibility... :)
I wouldn't have no problem with config settings, but site-wide...? There must be a system related reason why there are no block config settings possible...
Thank you!
Michael
I wouldn't have no problem with config settings, but site-wide...? There must be a system related reason why there are no block config settings possible...
Thank you!
Michael
UPDATE: I added this as a config option in the latest version of the addon. To enable this behaviour, add the following line to your config/site.php file:
define('DELUXE_IMAGE_GALLERY_DEFAULT_TITLES', 1);
Hi Jordan,
it seems that this config option (to have image file names displayed as titles by default) doesn't work any more with the latest version of deluxe image gallery and concrete5 5.5.2.
Can you confirm that?
Cheers,
Michael
it seems that this config option (to have image file names displayed as titles by default) doesn't work any more with the latest version of deluxe image gallery and concrete5 5.5.2.
Can you confirm that?
Cheers,
Michael
Are you on 5.5.2 or 5.5.2.1? I just tested it on 5.5.2.1 and it worked fine.
Note that it doesn't technically pull the file names as the default, but instead it uses the "Title" property of the images. Concrete5 by default will fill the "Title" property to the file name when files are uploaded, but is it possible that you disabled that functionality somehow, or removed the title properties from the files via the file manager?
Note that it doesn't technically pull the file names as the default, but instead it uses the "Title" property of the images. Concrete5 by default will fill the "Title" property to the file name when files are uploaded, but is it possible that you disabled that functionality somehow, or removed the title properties from the files via the file manager?
After deleting and recreating the gallery block, the configuration works nicely now. Thank you for the quick reply!
A customer would like to see the titles of images also in the lightbox (instead of the captions). I suppose there is there no easy way to achieve that, would you agree?
A customer would like to see the titles of images also in the lightbox (instead of the captions). I suppose there is there no easy way to achieve that, would you agree?
Shouldn't be hard to do with a custom template. Copy SITEROOT/packages/deluxe_image_gallery/blocks/deluxe_image_gallery/view.php to SITEROOT/blocks/deluxe_image_gallery/view.php, edit the new copy of the file, and change this line:
...to this:
And then to not show the titles in their original place under the thumbnails, either uncheck the "display titles" checkbox in the block edit dialog, or remove this chunk of code from the custom template:
<?php echo $img['caption']; ?>
...to this:
<?php echo $img['title']; ?>
And then to not show the titles in their original place under the thumbnails, either uncheck the "display titles" checkbox in the block edit dialog, or remove this chunk of code from the custom template:
Thank you so much for your help, Jordan, that works perfectly!
It's funny that you should ask about this -- this is how the gallery used to function but I got several requests from people to remove this because they usually don't want the filename to be the default title.
If you want to revert to the old behavior, you'll have to edit this file:
packages/deluxe_image_gallery/tools/images.inc.php
and change line #18 from this:
...to this:
If I do release another update to the gallery, I think I'll take this and another feature that some people want but some don't and turn them into config settings so that you can place something in your config/site.php file to change the behavior. Unfortunately at the present time, though, there's no way to make this change without modifying the package code as shown above.
-Jordan
EDIT: I've since updated the addon to make this a config setting -- see response down below.