Ciao a tutti,
sono un neofita con asp.net.
Vorrei che qualche anima pia mi aiutasse a risolvere questo problema:
da questa procedura di upload che funge vorrei poter ridimensionare l'immagine ad un valore preimpostato tipo 450x450 in maniera porporzionale e venga salvata nella cartella images. Mi piacerebbe che poi eseguisse di nuovo la procedura per creare una thunmbnail in un'altra cartella images_small di dimensioni proporzionali 100x100.
Ho cercato e ricercato ma non ho capito bene come si fà ...
Spero possiate aiutarmi e che possa essere utile anxche ad altri
Grazie a tutti per la comprensione...
Io sono partito da questo
if (Foto.PostedFile != null)
{
try
{
HttpPostedFile File_Foto = Foto.PostedFile;
string FileName_Foto = Path.GetFileName(File_Foto.FileName);
int FileLen_Foto = File_Foto.ContentLength;
if (FileLen_Foto > 1000000) // Check for Maximum File Length
{
lblMessage.Text = "Foto - (1000000 Bytes)";
return false;
}
if (FileLen_Foto > 0)
{
Stream Stream_Foto = File_Foto.InputStream;
FileName_Foto = ewdb.ewUploadFileName(FileName_Foto);
File_Foto.SaveAs (Server.MapPath("images/" + FileName_Foto)); oCmd.Parameters.Add("@Foto",OleDbType.VarWChar,255 ).Value = FileName_Foto;
}
}
catch (Exception oErr) // Error Handling
{}
}
che chiama questa procedura (che non fà nulla adesso ?!)
public string ewUploadFileName(string sFileName)
{
string sOutFileName;
// Amend your logic here
sOutFileName = sFileName;
// Return computed output file name
return sOutFileName;
} // End ewUploadFileName

Rispondi quotando
