FAP CUSTOMIZATION - Shorten Auto Character Length Name »  Show posts from    to     

Icy Phoenix


Archived phpBB Topics (Styles, Mods, Support) - FAP CUSTOMIZATION - Shorten Auto Character Length Name



Pete_Z [ Sat 02 Feb, 2008 11:53 ]
Post subject: 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 ]
Post subject: Re: Shorten Auto Character Length Name
See if this will give you the result you are seeking....

OPEN album_mod/abum_functions.php

FIND (2 separate places)
Code: [Hide] [Select]
return $pic_title;

BEFORE ADD (2 separate places)
Code: [Hide] [Select]
$pic_title = substr($pic_title, 0, 10);


buldo [ Mon 11 Feb, 2008 15:15 ]
Post subject: Re: Shorten Auto Character Length Name
Artie wrote: [View Post]
See if this will give you the result you are seeking....


Great Artie!


Artie [ Tue 12 Feb, 2008 03:59 ]
Post subject: Re: Shorten Auto Character Length Name
Your welcome Pete_Z....err I mean buldo


Pete_Z [ Tue 12 Feb, 2008 11:36 ]
Post subject: 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?


Artie wrote: [View Post]
Your welcome Pete_Z....err I mean buldo


Artie [ Tue 12 Feb, 2008 23:19 ]
Post subject: Re: Shorten Auto Character Length Name
Not a problem Pete_Z, I meant nothing personal. It was just my attempt at humor.

It shouldn't be difficult to make the title input mandatory using either php or js.


Pete_Z [ Fri 15 Feb, 2008 06:39 ]
Post subject: 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 onsubmit'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...
onsubmit="return validate_form(this);"


album_upload_body.tpl

Code: [Hide] [Select]
<script type="text/javascript">
function validate_required(field,alerttxt)
{
with (field)
{
if (value==null||value=="")
{
alert(alerttxt);return false;
}
else
{
return true;
}
}
}
</script>



I even tried using two
Code: [Hide] [Select]
<form name="upload" action="{S_ALBUM_ACTION}" method="post" onsubmit="return validate_form(this)">
<form name="upload" action="{S_ALBUM_ACTION}" method="post" enctype="multipart/form-data" onSubmit="{S_ON_SUBMIT}">



Well if anyone reads this and wants to share ideas please post.

Source
http://www.w3schools.com/js/js_form_validation.asp


Artie [ Sat 16 Feb, 2008 02:42 ]
Post subject: 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 var gFileuploadCounter = 1; just after

function checkAlbumForm()
{


it will test for title input always ... of course this may cause other problems .... dunno

In answer to you question the code for {S_ON_SUBMIT} is in album_upload.php and is return(checkAlbumForm()) unless you have nuffload enabled.

Hope this helps


Pete_Z [ Mon 05 May, 2008 18:03 ]
Post subject: 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! 0002




Powered by Icy Phoenix