Ciao, sto realizzando una griglia di immagini le quali, dopo esser state cliccate, fanno sì che a fianco della griglia compaia l'immagine più in grande.
Ho dovuto svolgere l'upload in PHP, la griglia in Dhtml, ma per le miniature ho dovuto usare il binomio Asp/Asp.Net.
Funziona tutto, ma ho solo un problema.![]()
Le miniature della griglia hanno una buona qualità (ho letto che il metodo usato ha problemi con width maggiori di 100) ma l'immagine a fianco (con width=300) è molto sgranata.
Premettendo che non credo di poter installare applicazioni di terze parti sul dominio (è un dominio a pagamento normale), c'è un modo per creare una thumbnail da 300 px di larghezza con una bassa quality loss?
Dover usare direttamente l'immagine uploadata e dire al cliente 'non inserire le tue foto 640x480' ma 'riducile con Photoshop a 300' è proprio la soluzione che vorrei evitare.. il cliente come la maggior parte è un incapace. :rollo:
Ho usato questo codice 'famoso':
Grazie per i vostri punti di vista, saluti!codice:<%@ Import Namespace="System.Drawing"%> <%@ Import Namespace="System.Drawing.Imaging"%> <SCRIPT RUNAT="SERVER"> Sub Page_Load() ' Initialize objects Dim objImage, objThumbnail As System.Drawing.Image Dim strServerPath, strFilename As String Dim shtWidth, shtHeight As Short ' Get image folder path on server - use "\" string if root strServerPath = Server.MapPath("/pp/images/") ' Retrieve name of file to resize from query string strFilename = strServerPath & Request.QueryString("filename") ' Retrieve file, or error.gif if not available Try objImage = objImage.FromFile(strFilename) Catch objImage = objImage.FromFile(strServerPath & "error.gif") End Try ' Retrieve width from query string If Request.QueryString("width") = Nothing Then shtWidth = objImage.Width ElseIf Request.QueryString("width") < 1 Then shtWidth = 100 Else shtWidth = Request.QueryString("width") End If ' Work out a proportionate height from width shtHeight = objImage.Height / (objImage.Width / shtWidth) ' Create thumbnail objThumbnail = objImage.GetThumbnailImage(shtWidth, _ shtHeight, Nothing, System.IntPtr.Zero) ' Send down to client Response.ContentType = "image/jpeg" objThumbnail.Save(Response.OutputStream, Imaging.ImageFormat.Jpeg) ' Tidy up objImage.Dispose() objThumbnail.Dispose() End Sub </SCRIPT>

 
					
					
					
						
  Rispondi quotando