Visualizzazione dei risultati da 1 a 3 su 3
  1. #1

    Galleria immagini da Directory

    Ciao a tutti!
    Non so più dove ..Dovrei creare una pagina in cui vengano visualizzate tante immagini quante sono quelle della directory in cui le vado a prendere.
    Il numero di immagini è a discrezione dell'utente, quindi potrebbero essere 5 come 20.
    Esiste un modo per visualizzarle a video e magari impaginarle in tabella?
    Cercavo qualcosa di analogo al "DO UNTIL rs.EOF" ma non ho ancora trovato nulla..

    Grazie mille in anticipo per l'attenzione

  2. #2
    fai qualche ricerca su google per
    asp for each file
    ...Se avanzo seguitemi... Se indietreggio uccidetemi...
    BiteFight... arruolati con me e non te ne pentirai

  3. #3
    Ho fatto sto obbrobbrio...
    codice:
    <%
    imgTypes = array("File JPG","File GIF","File PNG")
    imgPath = "/img/"
    maxWidth = 200
    maxHeight = 200
    
    function resizeImgView(theImgPath, theFileName, theMaxWidth, theMaxHeight, byRef theWidth, theHeight)
    	dim arrHeaders(34)	
    	set shell = server.createObject("Shell.Application")
    		set path = shell.namespace(server.mapPath(theImgPath))
    			for i = 0 to 33
    				arrHeaders(i) = path.getDetailsOf(path.items, i)
    			next
    			for each item in path.items	
    				if item = thefileName then															
    					theWidth = path.getDetailsOf(item, 27)
    					theWidth = cLng(left(theWidth,inStr(theWidth," ") - 1))
    					theHeight = path.getDetailsOf(item, 28)
    					theHeight = cLng(left(theHeight,inStr(theHeight," ") - 1))
    					if theWidth > theMaxWidth then
    						theRatio = int((theMaxWidth * 100) / theWidth)
    						theWidth = theMaxWidth
    						theHeight = int((theHeight * theRatio) / 100)
    					end if	
    					if theHeight > theMaxHeight then
    						theRatio = int((theMaxHeight * 100) / theHeight)
    						theHeight = theMaxHeight
    						theWidth = int((theWidth * theRatio) / 100)
    					end if										
    				end if
    			next
    		set path = nothing
    	set shell = nothing
    end function
    %>
    <html>
    	<head>
    		<title>Gallery</title>
    		<style type="text/css">
    		.gallery { 
    			float:left; 
    			width: <%=maxWidth + 40%>; 
    			height: <%=maxHeight + 40%>; 
    			border: 1px solid #000000; 
    			margin: 10; 
    			text-align:center; 			
    			padding: 10px;
    		}
    		img {
    			border:none;
    		}
    		</style>
    	</head>
    	<body>
    <%
    set fso = server.createObject("Scripting.FileSystemObject")
    if fso.folderExists(server.mapPath(imgPath)) then
    	set folder = fso.getFolder(server.mapPath(imgPath))
    	set files = folder.files
    		for each file in files
    		fileType = file.type 
    		fileName = file.name
    			for t = 0 to uBound(imgTypes)
    				if fileType = imgTypes(t) then
    					call resizeImgView(imgPath, fileName, maxWidth, maxHeight, w, h)
    %>
    		<div class="gallery">
    			[img]<%=imgPath & fileName%>[/img]" height="<%=h%>" alt="immagine <%=fileName%>" />
    		</div>
    <%
    					exit for
    				end if
    			next
    		next
    	set files = nothing
    	set folder = nothing
    end if
    set fso = nothing
    %>
    	</body>
    </html>

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.