Author Topic: How to Break Image Name  (Read 5527 times)

0 Members and 1 Guest are viewing this topic.

Offline killer007

  • Pre-Newbie
  • Posts: 5
    • View Profile
How to Break Image Name
« on: October 08, 2007, 03:19:31 AM »
Hello Guys I know this is not related with any Theme issue but i didnt find any other place to post this , so if posted this in a wrong section then i am Sorry.anyways here is my question.

How we can break a File Name if its greater than given limit like if we give limit of 10 Chrs so if a Filename is greater than 10 then show it in two lines .
For Example is Image name is "My School Days Picture One"  (as u can see its greater then 10 i want to show it like this"
My School
Days Picture
one.

I hope u understand.

Offline KurtW

  • 4images Guru
  • *******
  • Posts: 2.778
    • View Profile
    • Malediven-Bilder ~~Dreams~~
Re: How to Break Image Name
« Reply #1 on: October 08, 2007, 05:53:52 AM »

Offline killer007

  • Pre-Newbie
  • Posts: 5
    • View Profile
Re: How to Break Image Name
« Reply #2 on: October 08, 2007, 10:09:40 AM »
Thanks Kurt i will translate that page.. Thanks for quick reply.

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: How to Break Image Name
« Reply #3 on: October 08, 2007, 02:35:35 PM »
Quote
For Example is Image name is "My School Days Picture One"  (as u can see its greater then 10 i want to show it like this"
My School
Days Picture
one.


I have code too - this truncate on 2 (max 3) words each line if more chars 10 and more 2 words in text. ;)

Here is example:

Code: [Select]
$text = format_text(trim($image_name), 2);
   if (count(explode(" ", $text)) >= 2) {
       if (strlen($text) >= 2) {           
           $newtext = wordwrap($text, 10, "<br />\n");   
           echo $newtext;
       }
   }

;)
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline KurtW

  • 4images Guru
  • *******
  • Posts: 2.778
    • View Profile
    • Malediven-Bilder ~~Dreams~~
Re: How to Break Image Name
« Reply #4 on: October 08, 2007, 07:33:16 PM »
Hi killer007,

sorry, my link is not right. This mod makes the image name shorter...


10 chars=
My School Days Picture One => My School ...


Use thunderstrike code !


Kurt
 

Offline killer007

  • Pre-Newbie
  • Posts: 5
    • View Profile
Re: How to Break Image Name
« Reply #5 on: October 09, 2007, 05:34:57 AM »
Thanks Guys i Got it  :D