How to limit LENGTH of gallery names & Image names?

Strumelia
Strumelia
@strumelia
9 years ago
3,605 posts
Please see the attached screenshot.
Where/how do i LIMIT the length of the titles that my members can assign to their uploaded gallery Images, and also the titles of the Galleries they are making up?
The names they are choosing for both images AND galleries are often waaaay too long and causing overlap and/or just are plain annoying. One member recently titled his new Gallery (consisting of ONE photo): "Small Herd Of Elk (Wapiti) Taken At 7:00 A.M. On April 12. 2016 Just East Of My House With My I Phone" Um, yikes...!

I don't want to simply make the name trail off into "...." in the gallery page after a certain length....i really want to limit the length they can type in to begin with, because some folks are writing novels for their titles and I hate how it looks everywhere. =8-\

The other important side of this issue is- if I can do this, will it effect retroactively the images and galleries that are already on my site? Or will it simply begin to take effect from the time i make the change and then going forward? I don't want to mess up thousands of my members gallery images...they'd kill me! lol

thanks for any help.

(Another issue I have is that about 1/2 of the member gallery images come with ".jpg", ".JPG", or even ".JPG.jpg" still included on the end of their image name on my site's main /gallery page grid: http://fotmd.com/gallery/p=3 ....which adds unnecessary title length and looks really lame....but I'll create another thread asking how I can possibly sort that out.)
fotmd.com_gallery.jpg
fotmd.com_gallery.jpg  •  774KB




--
...just another satisfied Jamroom customer.
Migrated from Ning to Jamroom June 2015

updated by @strumelia: 09/09/16 03:47:37PM
michael
@michael
9 years ago
7,805 posts
open up the gallery create screen as an admin user, click on the "Form Designer" button.

gallery title -> modify

in the max column enter the 5 if you want the title limited to 5 characters.
Strumelia
Strumelia
@strumelia
9 years ago
3,605 posts
Ok will do this!
Michael- how will this effect all the previous galleries retroactively though?

How about for individual image titles? what about members who are uploading photos with incredibly long names?


--
...just another satisfied Jamroom customer.
Migrated from Ning to Jamroom June 2015
michael
@michael
9 years ago
7,805 posts
it puts a limit on the form field, so wont effect any existing titles.

It will effect existing titles if they try to update because it will show the form field.

It has no effect on uploading photos thats a different form field.

The only time the file name is used is if the file is downloaded. and perhaps in display sometimes. you can alter that in the templates.
Strumelia
Strumelia
@strumelia
9 years ago
3,605 posts
Ok I've set the Gallery title length limit in the form designer- thank you!! First issue solved. :)

Now, I can live with som eof the longer images titles, but they look so awful overlapping in the site's main Gallery grid- as in my first above screenshot.

Can i just solve the wrapping problem maybe?

here is the kind of image title that will NOT wrap on my site /gallery page:
1.jpg
1.jpg  •  255KB




--
...just another satisfied Jamroom customer.
Migrated from Ning to Jamroom June 2015
Strumelia
Strumelia
@strumelia
9 years ago
3,605 posts
...and here is a long image title that obediently wraps and gets cut off with "..." when it gets too long. That's what I want for all the long image titles showing in my /gallery page grid. See it here:
2.jpg
2.jpg  •  329KB




--
...just another satisfied Jamroom customer.
Migrated from Ning to Jamroom June 2015
michael
@michael
9 years ago
7,805 posts
(thought this was going in a different thread... ;) ) Thats the truncate function.

Smarty: Truncate
http://www.smarty.net/docs/en/language.modifier.truncate

In whichever template controls those titles being displayed it will look something like
{$item.gallery_title}
change that to
{$item.gallery_title|truncate:80}
to cut off at 80 characters, or if you want the ... then its
{$item.gallery_title|truncate:80:"..."}

Identifying which template it is is probably the most difficult thing, do you know which it is?
Strumelia
Strumelia
@strumelia
9 years ago
3,605 posts
Well, I've got this in my jrGallery_index.tpl:

{jrCore_include template="header.tpl"}

{capture name="template" assign="tpl"}
{literal}
    {jrCore_module_url module="jrGallery" assign="murl"}
    {if isset($_items)}
    <div class="container">
        {foreach from=$_items item="item"}
        {if $item@first || ($item@iteration % 6) == 1}
        <div class="row">
        {/if}
            <div class="col2{if $item@last || ($item@iteration % 6) == 0} last{/if}">
                <div class="img-profile">
                    <a href="{jrGallery_get_gallery_image_url item=$item}" title="{$item.gallery_alt_text}">{jrCore_module_function function="jrImage_display" module="jrGallery" type="gallery_image" item_id=$item._item_id size="large" crop="auto" class="iloutline img_scale" alt=$item.gallery_image_name title=$item.gallery_alt_text}</a><br>
                </div>
                <div class="center mb10">
                    <a href="{jrGallery_get_gallery_image_url item=$item}" title="{$item.gallery_alt_text}" class="bold">{if isset($item.gallery_image_title)}{$item.gallery_image_title|truncate:30:"...":false}{else}{$item.gallery_image_name|truncate:30:"...":true}{/if}</a><br>
                    <a href="{$jamroom_url}/{$item.profile_url}/{$murl}/{$item.gallery_title_url}/all" class="media_title">{$item.gallery_title}</a><br>
                    <a href="{$jamroom_url}/{$item.profile_url}" style="margin-bottom:10px"><span class="capital">@{$item.profile_url}</span></a>
                </div>
            </div>
            {if $item@last || ($item@iteration % 6) == 0}
        </div>
        {/if}
        {/foreach}
    </div>
    {/if}
{/literal}
{/capture}

<div class="block">

    <div class="title">
        {jrSearch_module_form fields="gallery_title,gallery_image_title,gallery_caption,gallery_description,gallery_image_name"}
        <h1>Photos</h1>
    </div>

    <div class="block_content">
        <div class="item">
            <div class="container">
                <div class="row">
                    {jrCore_list module="jrGallery" order_by="_item_id desc" require_image="gallery_image" pagebreak=60 page=$_post.p pager=true template=$tpl}
                </div>
            </div>
        </div>
    </div>

</div>

{jrCore_include template="footer.tpl"}



--
...just another satisfied Jamroom customer.
Migrated from Ning to Jamroom June 2015

updated by @strumelia: 06/08/16 08:47:42PM
Strumelia
Strumelia
@strumelia
9 years ago
3,605 posts
-how can I keep my code frombeing cut off on the right here when quoting it? :(


--
...just another satisfied Jamroom customer.
Migrated from Ning to Jamroom June 2015
Strumelia
Strumelia
@strumelia
9 years ago
3,605 posts
Sorry- I am being called away and have to get back to this thread tomorrow, it's midnight.
Thanks for your help so far!
(I didn't think the ".jpg" thing was connected to the wrapping/truncating issue, thus I haven't started a separate thread for both. :( )


--
...just another satisfied Jamroom customer.
Migrated from Ning to Jamroom June 2015
paul
@paul
9 years ago
4,335 posts
Try setting a third truncate parameter to 'true' so as to force an absolute truncation (not on the nearest word boundary) - http://www.smarty.net/docsv2/en/language.modifier.truncate.tpl

So in line 18 of the above code, {$item.gallery_title} becomes something like {$item.gallery_title|truncate:18:"":true}


--
Paul Asher - JR Developer and System Import Specialist
Strumelia
Strumelia
@strumelia
9 years ago
3,605 posts
Done and done and done! :D

Michael and Paul- I have learned SO MUCH from this discussion, I'm so THRILLED.

FIRST: I've finally learned to find and work with more of the form designers in my site. This has been a mystery that I've awkwardly stumbled my way through for a long time.
Once I opened and modified the Gallery title form designer to limit gallery names to a certain maximum length (in both 'create' and in 'update') as Michael laid out for me above,
I didn't stop there.
The light bulb came on in my head, and I proceeded to go into many form designers all over my site to limit the LENGTH members can type in for: new Image titles, for Youtube and Vimeo video titles, for Soundcloud and audio clip titles, for new Group Discussions, for new Forum discussions, for Event titles, for new Group names, and even for new member profile names!
At last- no more members with names like: Dr. Eugene F. EagleEye Merryweather Jr. Seriously annoying! Oh Boy can't believe I didn't catch onto this at least six months ago. But hey, I guess my brain wasn't yet ready for the revelation back then. ("You can't HANDLE the truth!" lol)
and as if that weren't enough....

SECOND: the Truncate thing. Went in my active skin's jrGallery_index.tpl and applied Paul's suggestion above and I saw how it worked nicely for the gallery titles on my site's /gallery index page grid of all member photos. Soooo... I went further still on my /Gallery index page and applied the truncate also to the Image titles (in addition to the gallery titles) AND to the member profile links as well under each thumbnail. now they all take up reasonable amounts of space before ending in "..." and their links still work great.
"Dr. Eugene F. EagleEye Merryweather Jr." s hotlink name no longer takes up 3 damn lines under each of his gallery thumbnail images adding unwanted giant spaces all over the page because he's a Name Hog-- instead he's now "Dr. Eugene F. Eag..." but the link to his profile still works fine. Hah!

So-
1) I've learned a TON about using the form designers....
2) AND about putting reasonable length limits on input names and labels from my members-- ALL OVER my site for all kinds of items.
3) PLUS I was able to truncate three different text/link items on my Gallery index page and make that page look way neater,
...which was the actual modest goal I had when starting this thread. :D

But it became so much more and really helped me move an important step forward in editing and modifying my site.

Thanks to the JR Team for your patient and good natured help on this forum. It does actually have a productive result, way more often than you know!



--
...just another satisfied Jamroom customer.
Migrated from Ning to Jamroom June 2015

updated by @strumelia: 06/10/16 07:16:17PM
michael
@michael
9 years ago
7,805 posts
:) :)