Icy Phoenix

     
 


This forum is locked: you cannot post, reply or edit topics.  This topic is locked: you cannot edit posts or make replies. 
Page 1 of 1
 
 
Reply with quote Download Post 
Post 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 
Pete_ZSend private message  
Back to topPage bottom
Icy Phoenix is an open source project, you can show your appreciation and support future development by donating to the project.

Support us
 
Reply with quote Download Post 
Post 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);

 



 
ArtieSend private message  
Back to topPage bottom
Reply with quote Download Post 
Post Re: Shorten Auto Character Length Name 
 
Artie wrote: [View Post]
See if this will give you the result you are seeking....


Great Artie!
 




____________
~~~ Andrea ~~~
User #379756 on Linux Counter
"If you can't apt-get something, it isn't useful or doesn't exist!!"
 
buldoSend private messageVisit poster's website  
Back to topPage bottom
Reply with quote Download Post 
Post Re: Shorten Auto Character Length Name 
 
Your welcome  Pete_Z....err I mean buldo
 



 
ArtieSend private message  
Back to topPage bottom
Reply with quote Download Post 
Post 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

 



 
Last edited by Pete_Z on Tue 12 Feb, 2008 11:38; edited 1 time in total 
Pete_ZSend private message  
Back to topPage bottom
Reply with quote Download Post 
Post 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.
 



 
ArtieSend private message  
Back to topPage bottom
Reply with quote Download Post 
Post 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.  

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



 
Pete_ZSend private message  
Back to topPage bottom
Reply with quote Download Post 
Post 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  
 



 
ArtieSend private message  
Back to topPage bottom
Reply with quote Download Post 
Post 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
 



 
Pete_ZSend private message  
Back to topPage bottom
This forum is locked: you cannot post, reply or edit topics.  This topic is locked: you cannot edit posts or make replies.  Page 1 of 1
 


Display posts from previous:    

HideWas this topic useful?

Link this topic
URL
BBCode
HTML




 
Permissions List
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


  

 

  cron