Browse Source

Likelihood of over 1.6 million images for comparison in a personal library is likely rare. Improved performance of the thumbnail system by avoiding creating an overwhelming number of sub directories within sub directories to artifically handle a billion billion billion billion billion possbile md5 combinations. There just aren't that many files so it's a waste to presume non-even distribution of md5's such that it would break a filesystem requiring such limiting of directories for storage.

master
Drew Short 10 years ago
parent
commit
18ee94a9f2
  1. 6
      src/main/scala/com/sothr/imagetools/image/ImageService.scala

6
src/main/scala/com/sothr/imagetools/image/ImageService.scala

@ -79,10 +79,8 @@ object ImageService extends Logging {
def calculateThumbPath(md5:String):String = {
//break the path down into 4 char parts
val split:List[String] = md5.grouped(3).toList
var dirPath = ""
for (index <- 0 until (split.length-1)) dirPath += split(index) + "/"
var path:String = s"${PropertiesService.get(PropertiesEnum.ThumbnailDirectory.toString)}${PropertiesService.get(PropertiesEnum.ThumbnailSize.toString)}/$dirPath"
val subPath = md5.substring(0, 3)
var path:String = s"${PropertiesService.get(PropertiesEnum.ThumbnailDirectory.toString)}${PropertiesService.get(PropertiesEnum.ThumbnailSize.toString)}/$subPath/"
try {
val dir = new File(path)
if (!dir.exists()) dir.mkdirs()

Loading…
Cancel
Save