PDA

View Full Version : image slideshow - modifying the image title



tpeck
Oct 11th, 2011, 12:19 PM
This is part of a php image slideshow.

Somewhere in the code below is the bit which displays the name of the image (taken from the image filename).

At present it displays like this:

http://aapress.com.au/demo/slideshowtitledisplay.png

I'm guessing the name display is around the red part below. What I'm trying to do is prevent the extension being displayed (i.e. remove ".jpg" and add some space before the image number is displayed). If I'm right, I think the second lot of code below is what must be modified to remove the extension.

How do I go about this? The actual code in its entirety is taken from this website: http://panmental.de/public/programming_projects/Slideshow%20script%20in%20PHP/phpshow.php



<body onload=\"preload()\" style=\"margin:15px;background-color:$bgcolor\">
<div align=\"center\" class=\"controlTable\">
<table style=\"vertical-align:middle; margin-bottom:2px;\" align=\"center\" border=\"0\" cellpadding=\"1\" cellspacing=\"0\">
<tr><td>
<input class=\"slidebrowse\" type=\"button\" value=\"$browseString\" name=\"browse\" onClick=\"browseIt();\">
</td><td>";
if($startFit)
echo "<input class=\"sizebutton\" id=\"resize\" type=\"button\" value=\"$actualString\" name=\"fit\" onClick=\"resizeIt();\">";
else
echo "<input class=\"sizebutton\" id=\"resize\" type=\"button\" value=\"$fitString\" name=\"fit\" onClick=\"resizeIt();\">";
echo "</td><td><input id=\"pause\" class=\"playpause\" type=\"button\" value=\"";
if($autoplay)
echo $pauseString;
else
echo $playString;
echo "\" name=\"stop\" onClick=\"stopit(true);\">
</td><td><select class=\"timer\" id=\"sel\" size=\"1\" name=\"del\" onChange=\"selected();\">";
echo "<option value=\"".intval(($initialDelay/2.0)*1000)."\">".($initialDelay/2.0)." $secString</option>";
echo "<option selected value=\"".intval($initialDelay*1000)."\">$initialDelay $secString $delayString</option>";
echo "<option value=\"".intval(($initialDelay/2.0)*3000)."\">".($initialDelay/2.0*3.0)." $secString</option>";
echo "<option value=\"".intval(($initialDelay/2.0)*4000)."\">".($initialDelay/2.0*4.0)." $secString</option>";
echo "<option value=\"".intval(($initialDelay/2.0)*6000)."\">".($initialDelay/2.0*6.0)." $secString</option>";
echo "</select></td></tr><tr>
<td colspan=\"4\" style=\"text-align:center\">
<p><br><table width=\"100%\"><tr><td style=\"text-align:center;\" width=\"50%\">
<a class=\"goLink\" href=\"javascript:";
if($useFading)
echo "goDir=0;$timeOutFunc;";
else
echo "goback();";
echo "\"><img border=\"0\" src=\"../../images/back.png\" width=\"21\" height=\"21\">$backString</a></td><td style=\"text-align:center;\" width=\"50%\"><a class=\"goLink\" href=\"javascript:$timeOutFunc;\">$nextPageString<img border=\"0\" src=\"../../images/next.png\" width=\"21\" height=\"21\"></a>
</td></tr></table>
</td></tr>
</table></div>
<div align=\"center\" id=\"picInfo\">";
$info = getimagesize("$basePath$filter_files[$aktnr]");
echo $filter_files[$aktnr]."&nbsp;(".$info[0]."x".$info[1].")&nbsp;#".($aktnr+1)."/".sizeof($filter_files);
echo "</div>
<table align=\"center\"><tr><td class=\"currpic\" onclick=\"checkGoto();\" style=\"z-index:10; width:1px; height: 1px;\">
<img ";
if($stopOnMouseOver)
echo " onmouseover=\"stopTemp()\" onmouseout=\"endStopTemp()\" ";
echo " id=\"currpici\" border=\"0\" style=\"z-index:0;\" src=\"$basePath$filter_files[$aktnr]\" alt=\"\" title=\"";
if($showTitle)
echo $filter_files[$aktnr];
echo "\" width=\"1\" height=\"1\">
</td></tr></table>
";
if($useFading){
for($i=1;$i<=$fadeSteps;$i++){
echo "<img ";
if($stopOnMouseOver)
echo " onmouseover=\"stopTemp()\" ";
echo "alt=\"$i\" class=\"opaquepic\" style=\"position:absolute; visibility:hidden; z-index:1;\" id=\"opi$i\" src=\"$SCRNAME?opaque$sep".round((127.0/$fadeSteps)*($fadeSteps-$i))."$sep"."$i"."$sep"."$fadeMode\"/>
";
}
}
echo "<div align=\"center\" style=\"text-align:center; width:100%; z-index:99;\" id=\"picLoaded\"><span id='wait1' style='visibility:hidden'>&nbsp;.&nbsp;</span><span id='wait2' style='visibility:hidden'>.&nbsp;</span><span id='wait3' style='visibility:hidden'>.&nbsp;</span><br/>$notLoadedString<br/><br/></div>
$aftertext
</body></html>";
die;
}
//end part for showing a slideshow


function showPicInfo(){
if((!picTexts[current])||(picTexts[current]==\"\")){
ttext=\"<span class='info'>\"+picNames[current]+\"</span>\";";
if($showTitle)
echo "currentPic.title=picNames[current];";
echo " }
else{
ttext=\"<span class='info'>\"+picTexts[current]+\"</span>\";\r\n";
if($showTitle)
echo "currentPic.title=picTexts[current];";
echo " }
if((picLinks[current])&&(picLinks[current]!=\"\"))
currentPic.style.cursor=\"pointer\";
else
currentPic.style.cursor=\"default\";// firstChild.nodeValue
noda.innerHTML=ttext";
if($showPicSize)
echo "+\" (\"+picWidths[current]+\"x\"+picHeights[current]+\")\"";
if($showPicNum)
echo "+\" #\"+(current+1)+\"/".sizeof($filter_files)."\"";
echo ";
if(allPics[current].complete==false){
currentPic.width =1;
currentPic.height=1;
self.clearTimeout(counting);
";
if($useFading){
for($i=1;$i<=$fadeSteps;$i++)
echo " opaq$i.width =1;\r\n opaq$i.height =1;\r\n";
echo "fStep=-1;
doOpi(fStep);
";
}