https://www.icyphoenix.com/viewtopic.php?f=26&t=3545 ----------------------------------- Pete_Z Sat 02 Feb, 2008 11:53 FAP CUSTOMIZATION - Shorten Auto Character Length Name ----------------------------------- So I noticed that when a member does not add a name to thier uploaded image, it uses the imags defult name.... what I end up seing is 35+ characters in the file image name. Then, what this does is break the layout in members profile and other misc. mods that use tables. things start looking wacky. Is there a way to automaticly shorten these long names when they get uploaded? like say cut it off at 10 characters, for example... ----------------------------------- Artie Thu 07 Feb, 2008 23:25 Re: Shorten Auto Character Length Name ----------------------------------- See if this will give you the result you are seeking.... OPEN [b]album_mod/abum_functions.php[/b] FIND (2 separate places) [codeblock]return $pic_title;[/codeblock] BEFORE ADD (2 separate places) [codeblock]$pic_title = substr($pic_title, 0, 10);[/codeblock] ----------------------------------- buldo Mon 11 Feb, 2008 15:15 Re: Shorten Auto Character Length Name ----------------------------------- [quote user="Artie" post="24001"]See if this will give you the result you are seeking....[/quote] Great Artie! :up: ----------------------------------- Artie Tue 12 Feb, 2008 03:59 Re: Shorten Auto Character Length Name ----------------------------------- Your welcome Pete_Z....err I mean buldo :icy_lol_flag: ----------------------------------- Pete_Z Tue 12 Feb, 2008 11:36 Re: Shorten Auto Character Length Name ----------------------------------- No no, I read you a coulple days ago, I wasn't able to test yet and give feed back. What happned was that it kept my titlels short no matter what. ie: uploading. Would it be easier to prevent an upload with javascript when there is no title added? [quote user="Artie" post="24121"]Your welcome Pete_Z....err I mean buldo :icy_lol_flag:[/quote] ----------------------------------- Artie Tue 12 Feb, 2008 23:19 Re: Shorten Auto Character Length Name ----------------------------------- Not a problem Pete_Z, I meant nothing personal. It was just my attempt at humor. :mrblue: It shouldn't be difficult to make the title input mandatory using either php or js. ----------------------------------- Pete_Z Fri 15 Feb, 2008 06:39 Re: Shorten Auto Character Length Name ----------------------------------- Yeah it would probably be easier to have a manditory name then to use huge file name extention as a name... I am experimenting with javascript, but I can not have two [b]onsubmit[/b]'s in one forum... unless i am doing something wrong. Where exactly can I find the code inside {S_ON_SUBMIT} ? Maybe I can fit the javascript in there... [b]onsubmit="return validate_form(this);"[/b] [b]album_upload_body.tpl[/b] [code linenumbers=false] [/code] I even tried using two [code linenumbers=false]
[/code] Well if anyone reads this and wants to share ideas please post. :mrorange: Source http://www.w3schools.com/js/js_form_validation.asp ----------------------------------- Artie Sat 16 Feb, 2008 02:42 Re: Shorten Auto Character Length Name ----------------------------------- Javascript is not my strong suit (neither is php for that matter), but from what I can tell the js function for the form validation already exist...... It seems only to check for a title when your ACP setting is limited to 1 pic upload at a time. If you allow multiple uploads then it does not check for title input. In the upload tpl file if you place [highlight=#FFFFAA]var gFileuploadCounter = 1;[/highlight] just after [highlight=#FFFFAA]function checkAlbumForm() {[/highlight] it will test for title input always ... of course this may cause other problems .... dunno In answer to you question the code for [highlight=#FFFFAA]{S_ON_SUBMIT}[/highlight] is in album_upload.php and is [highlight=#FFFFAA]return(checkAlbumForm())[/highlight] unless you have nuffload enabled. Hope this helps 8) ----------------------------------- Pete_Z Mon 05 May, 2008 18:03 Re: Shorten Auto Character Length Name ----------------------------------- doh.... a big Homer Simpson doh! ... thank you Artie.. it works. Yes I just now tryed it. it does exactly what I wanted it to do. thanks! [img]http://www.icyphoenix.com/images/smiles/0002.gif[/img]