SOLVED FAP CUSTOMIZATION - Shorten Auto Character Length Name


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...

Last edited by Pete_Z on Sat 02 Feb, 2008 11:55; edited 1 time in total
Profile PM  
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: [Download] [Hide] [Select]
return $pic_title;

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

Profile PM  
Subject: Re: Shorten Auto Character Length Name
Artie wrote: [View Post]
See if this will give you the result you are seeking....


Great Artie! :up:

Subject: Re: Shorten Auto Character Length Name
Your welcome Pete_Z....err I mean buldo :icy_lol_flag:

Profile PM  
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 :icy_lol_flag:

Last edited by Pete_Z on Tue 12 Feb, 2008 11:38; edited 1 time in total
Profile PM  
Subject: 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.

Profile PM  
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: [Download] [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: [Download] [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. :mrorange:

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

Profile PM  
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 8)

Profile PM  
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

Profile PM  

Page 1 of 1


  
You cannot post new topics
You cannot reply to topics
You cannot edit your posts
You cannot delete your posts
You cannot vote in polls
You cannot attach files
You can download files
You cannot post calendar events

   

This is a "Lo-Fi" version of our main content. To view the full version with more information, formatting and images, please click here.

Powered by Icy Phoenix based on phpBB
Generation Time: 0.1155s (PHP: 15% SQL: 85%)
SQL queries: 10 - Debug Off - GZIP Enabled