Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 16
  1. #1

    ottenere dimesioni di un immagine

    esiste una funzione che mi permetta di ottenere le dimensioni width e height di un immagine??

  2. #2
    Utente di HTML.it L'avatar di pietro09
    Registrato dal
    Jan 2002
    Messaggi
    10,116

    Re: ottenere dimesioni di un immagine

    Originariamente inviato da maurizio127
    esiste una funzione che mi permetta di ottenere le dimensioni width e height di un immagine??
    sì, e si chiamano proprio width e heght
    Pietro

  3. #3
    ok... ma come si applica??

    io ho una serie di immagini. devo controllare le due dimensioni.
    in più devo capire se il file esiste oppure no.

  4. #4
    ho provato così:

    path = "http://nomesito.it/immagine.jpg"
    Dim fs

    fs = Server.CreateObject("Scripting.FileSystemObject")

    If fs.FileExists(path) Then
    Response.Write("il file esiste")

    Else
    Response.Write("Il file non esiste")
    End If

    fs = Nothing

    ma l'istruzione if da sempre falso anche se il file esiste... sbaglio qualcosa??

  5. #5
    Utente di HTML.it L'avatar di pietro09
    Registrato dal
    Jan 2002
    Messaggi
    10,116
    codice:
    Dim f As String = "C:\dati\Prove Nicon\DSCN0014.JPG"
    If File.Exists(f) Then
    	Dim bmp As New Bitmap(f)
    
    	Response.Write(String.Format("Width = {0}, Height = {1}", bmp.Width, bmp.Height))
    	bmp.Dispose()
    
    End If
    Pietro

  6. #6
    ho copiato il codice che hai scritto sulla mia pagina e gli errori che mi da sono:

    1) nome File non dichiarato
    2) tipo Bitmap non definito

    Dim f As String = "C:\dati\Prove Nicon\DSCN0014.JPG"
    If File .Exists(f) Then
    Dim bmp As New Bitmap (f)

    Response.Write(String.Format("Width = {0}, Height = {1}", bmp.Width, bmp.Height))
    bmp.Dispose()

    End If

  7. #7
    Utente di HTML.it L'avatar di pietro09
    Registrato dal
    Jan 2002
    Messaggi
    10,116
    codice:
    Option Strict On
    
    Imports System.IO
    Imports System.Drawing
    
    Partial Class prove_a
        Inherits System.Web.UI.Page
    
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            Dim f As String = "C:\dati\Prove Nicon\DSCN0014.JPG"
            If File.Exists(f) Then
                Dim bmp As New Bitmap(f)
    
                Response.Write(String.Format("Width = {0}, Height = {1}", bmp.Width, bmp.Height))
                bmp.Dispose()
    
            End If
    
    
        End Sub
    End Class
    Pietro

  8. #8
    all'interno di visual web developer ho provato a copiare quello che mi scritto, ma è tutto un errore!! Option Strict On, Imports, Partial, Protected Sub, Inherits e anche Bitmap e File!!!

    non so come fare!

  9. #9
    Utente di HTML.it L'avatar di pietro09
    Registrato dal
    Jan 2002
    Messaggi
    10,116
    codice:
    <html>
    <body>
    <%
    Dim f As String = "C:\dati\Prove Nicon\DSCN0014.JPG"
    If System.IO.File.Exists(f) Then
    	Dim bmp As New System.Drawing.Bitmap(f)
    
    	Response.Write(String.Format("Width = {0}, Height = {1}", bmp.Width, bmp.Height))
    	bmp.Dispose()
    
    End If
    
    
    
    %>
    </body>
    </html>
    questo è fatto col notepad, se non va, ci sono altri problemi
    Pietro

  10. #10
    così non mi da nessun errore, però c'è un però:

    io ho cambiato il percorso della foto con una cosa tipo "http://www.miosito.it/immagine.jpg"

    e pur esistendo il file non esegue l'if.... per caso ci voglio permessi sulla cartella per scrittura?

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 © 2025 vBulletin Solutions, Inc. All rights reserved.