Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Picture Captions
Is there a way to add captions to pictures ? If not what are the best alternatives to Filebrowser I can't seem to find anything thats as easy to use a nice looking.
0
This discussion has been closed.
Comments
dscf0049.jpg Dee, Flory, Zoey, Butch and Joyce dscf0050.jpg Dee and Zoey
I don't use the filename right now, but it will be useful if someone makes an additional mod to use it as the key to get the caption. However, right now the captions must be in the same order as the files in your directory.
Change the index.php file as follows:
Add the following at the top after the XML settings:
// captions settings - jimw 7/13/7 define("show_captions", true); define("captions_file", "captions.txt");
In the function FormatDisplayedItem, just below the case "Image" line, add:
if ( show_captions ) { // open and parse captions file (jimw mod 7/13/7) if (file_exists($Config->CurrentBrowsingDirectory."/".captions_file)) { $no_file = false; $fp = fopen($Config->CurrentBrowsingDirectory."/".captions_file, 'rb'); if($fp) { $i = 0; while ($row = fgetcsv($fp, 100, "\t")) { list($files[$i], $captions[$i]) = $row; $i++; } fclose($fp); } } else { $no_file = true; } }
Then replace the
$Return .= "</div>\r\n";
line with:if ( show_captions ) { // check captions setting (jimw mod 7/13/7) if ( $no_file ) { $Return .= "</div>\r\n"; } else { $Return .= "</div>".$captions[$ItemID]."\r\n"; } } else { $Return .= "</div>\r\n"; }
You can then format the captions by putting whatever tag you want around it.
I hope this works for you.
case "Image": $caption = ""; if ( show_captions ) { // open and parse captions file (jimw mod 7/13/7) if (file_exists($Config->CurrentBrowsingDirectory."/".captions_file)) { $no_file = false; $fp = fopen($Config->CurrentBrowsingDirectory."/".captions_file, 'rb'); if($fp) { $i = 0; while ($row = fgetcsv($fp, 100, "\t")) { list($files[$i], $captions[$i]) = $row; if ($files[$i] == $FileName) $caption = $captions[$i]; $i++; } fclose($fp); } } else { $no_file = true; } } // $Handled = true; $Return .= "<input type=\"hidden\" name=\"ImgTag$ItemID\" value='<img src=\"".$EncodedPath."\" />' /> <li class=\"CopyImg\"><a href=\"Javascript:copy(document.frmLinkContainer.ImgTag$ItemID);\">Copy img tag</a></li> </ul> <div class=\"DisplayItemImage\">"; if ($Config->FitImagesToPage) { $ImageSize = @getimagesize($FolderPath); if ($ImageSize) { $Return .= "<script>writeImage('$EncodedPath', ".$ImageSize[0].", ".$ImageSize[1].", '".$ItemID."');</script>"; } else { $Return .= "<img src=\"$EncodedPath\" alt=\"\" />"; } } else { $Return .= "<img src=\"$EncodedPath\" alt=\"\" />"; } $Return .= "</div>".$caption."\r\n"; break;
This uses the actual image filename to find the corresponding caption in the captions file.