Sortable Fancybox Gallery picture names underscore

Permalink 1 user found helpful
Hello,

My question is:
How can i replace the underscore in the picture name, between the words to empty spaces?

 
wagdi replied on at Permalink Reply
wagdi
I think you'll need to edit the properties for each image. Do that in the file manager.. select image>> properties>> amend as desired.
admin replied on at Permalink Reply
i can't rename pictures in File Manager...
Do you have another solution?
JohntheFish replied on at Permalink Reply
JohntheFish
This involves some php.

Create a custom view template for sortable fancybox, as per the general instructions in:

http://www.concrete5.org/documentation/how-tos/developers/change-th...

Then, within the output loop of the custom template (assuming the variable name is $title), insert a line of code along the lines of (untested code)
$title = preg_replace("/\_+/",' ',$title);


There are other ways of munging text, including some C5 helper functions you may want to look up. I just picked on a regular expression because its the first hack that came to mind.

Finally, with your new template in place, select it in the Custom Template menu for the block when in edit mode.
admin replied on at Permalink Reply
Hello John,

Thanks for your reply, but I do not understand what I have to do exactly. I'm afraid i'll overwrite something I shouldn't... Can you help me through this?
JohntheFish replied on at Permalink Reply
JohntheFish
These are generic instructions, rather than specific to your problem.

What you are doing is creating a new view template.

As per the howto, you copy the view.php for the gallery to siteroot/blocks/sortable_fancybox_gallery/templates/ folder (create the folder(s) as necessary), and rename the copied view.php to 'my_templatename.php'. (ie you NEVER edit or rename the original)

This creates a new template so you can't screw up any existing code.

You then edit the php for 'my_templatename.php', locate the point in the output loop where the title is about to be displayed, and insert the preg_replace line. The variable may be called something other than $title, but the chances are it will be something like that.

Finally, you edit the page and select the gallery block and select the custom template you just created.

If you don't know at least some basic php programming, don't even attempt this.

If, with some basic php skills and reading the howto you are still lost, again please don't even attempt this.
jordanlev replied on at Permalink Best Answer Reply
jordanlev
You change the titles via the "Title" property. In the file manager, click on an image, choose "Properties" from the popup menu, then click on the word "Title" and an edit box will appear to the right. After you change the title, click the little "paper and pencil" icon to save it.
admin replied on at Permalink Reply
Yes! That's it!
Thanks!

But... it's a shame that this add-on automatically turns "space" into a "_"
So now i have to rename all the photo's by hand...
jordanlev replied on at Permalink Reply
jordanlev
The addon is not turning spaces into underscores... Concrete5 does that when the images are first uploaded. I agree that it's annoying, and I wish there were a better way to edit lots of attributes quickly, like a spreadsheet in the dashboard or something.
admin replied on at Permalink Reply
Yes i feel the same!
jordanlev replied on at Permalink Reply
jordanlev
I'm a terrible self-promotor -- I forgot to mention that I have a paid addon in the marketplace called Deluxe Image Gallery, which is similar to Sortable Fancybox but adds some advanced features like bulk editing of titles and captions directly from the block edit dialog:
http://www.concrete5.org/marketplace/addons/deluxe-image-...

-Jordan
JohntheFish replied on at Permalink Reply
JohntheFish
Didn't you just reject that solution when Wagdi suggested it? If you had accepted it then you could have saved me time trying show you an alternative.