Comment afficher des images sous forme de vignettes ou de miniatures?
:salut:
je poste ce que code pour rechercher les images avec les extensions "jpg, gif, png, bmp, psd, tif" dans le dossier et sous-dossiers et le résultat sera afficher dans un fichier de sortie en html.
Mon but est Comment puis-je afficher des images sous forme de vignettes ou miniatures liés aux Originaux?
je crois qu'on peut utiliser une Astuce ou un Truc en html mais qu'ils m'échappent encore :cry:
Merci de votre aide :ccool:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
| start_folder = ".\"
htmfile = "Liste_Images.htm"
ext = Array("jpg","gif","bmp","psd","tif") 'extensions des Images à rechercher
count=0
Set fso = CreateObject("Scripting.FileSystemObject")
Set folder = fso.GetFolder(start_folder)
Set ws = CreateObject("WScript.Shell")
Set outfile = fso.CreateTextFile(htmfile)
strHTML="<html><body><style type='text/css'>"&_
"a:link {color: #F19105;}"&_
"a:visited {color: #F19105;}"&_
"a:active {color: #F19105;}"&_
"a:hover {color: #FF9900;background-color: rgb(255, 255, 255);}"&_
"</style>"
strHTML=strHTML &"<center><h2><B><font color=red>Le Nombre Total des images est [COUNT]</font></B></h2></center>" & _
"<table border='1' style='border-collapse: collapse; font size:9pt' bordercolor='#CCCCCC' width='100%' id='Table1'>" & _
"<tr><td><center><strong>Image</strong></center></td><td><center><strong>Chemin</strong></center></td>" & _
"<td><center><strong>Taille<strong></center></td><td><center><strong>Type</strong></center></td>" & _
"<td><center><strong>Modifié le</strong></center></td><td><center><strong>Dernier Accès</strong></center></td></tr>"
ListDirectory folder, ext
strHTML = strHTML & "</table>"
strHTML = Replace(strHTML, "[COUNT]", Count)
outfile.WriteLine strHTML &"</body></html>"
outfile.Close
Explorer htmfile
Sub ListDirectory(folder, ext)
For Each objFile In folder.Files
cheminFic = folder & "\" & objFile.name
For i = lbound(ext) to ubound(ext)
If UCase(ext(i)) = UCase(fso.GetExtensionName(objFile.Name)) Then
count=count+1
strFileName = objFile.Name
strFilePath = objFile.ParentFolder
strFileSize = FormatNumber((objFile.Size/1024),2) + " Kb"
strFileType = objFile.Type
strFileModified = objFile.DateLastModified
strFileAccess = objFile.DateLastAccessed
strHTML = strHTML & "<tr><td><img src= '"& cheminFic &"'></td><td><a href='" & strFilePath & "'>" & _
strFilePath & "</a></td><td>" & strFileSize & "</td>" & _
"<td>" & strFileType & "</td><td>" & strFileModified & "</td>" & _
"<td>" & strFileAccess & "</td></tr>"
End If
Next
Next
For Each fldr In folder.subfolders
ListDirectory fldr, ext
Next
End Sub
Function Explorer(File)
Set ws=CreateObject("wscript.shell")
ws.run "Explorer "& File & "\"
end Function |