Ok.. sorry for asking so many questions lol 😃 ive been doing lots of googling... and i learnt this code from the PHP documentation.
$break = pathinfo($file);
$b = $break['extension'];
$f = wordwrap($file, 15, "<br>", true);
$c = explode(".", $file);
// this bit below is the new code.. i put the other bit for reference.
$d = substr($c[0], 0, 5);
echo " '.$d.'.'.$b.' ";
So this works fine.. if i have a file name longer than 5 chars it will remove the other characters... but still display the file extension obviously..
But what i would like to do is.. if the substr has been performed.. i would like a COLOR="Red" [/COLOR] to be displayed before the file extension.. to sort of notify the user that this is not the full file name. Does anybody know how to do this? i figure its some sort of IF statement..
like IF(filelengthismorethan5) {
echo "$first5characters, (...), $extension";
else {
echo "$filename, $extenstion";
}
so you see what i mean? i think that is the correct logic as to how it would work.. im just not sure how to make it work 😕😕
Thankyou! im learning slowly :quiet:🙂
EDIT: i just modified it a little... so that i am not using explode()... now $c is..
$c = $break['filename'];
i did this because if a file was called for example image.2009.jpg then only the image bit would be picked up.