Bonjour,
J'ai developpé la fonction suivante qui me permet d'enregistrer les photo sur un répertoire :
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
| Private Sub SavePhotoFromDB(ByVal IdPersonne As String, ByVal Stockage_Photo As Byte())
Dim photo As Byte()
Dim stream As New MemoryStream
Dim PathPhoto As String = ConfigurationSettings.AppSettings("UrlPhoto")
Dim FullPathPhoto As String = IO.Path.Combine(PathPhoto, IdPersonne & ".jpg")
Dim RemotePathPhoto As String = ConfigurationSettings.AppSettings("RemoteUrlPhoto")
Try
photo = Stockage_Photo
stream.Write(photo, 0, photo.Length)
Dim bitmap As New Bitmap(stream)
bitmap.Save(RemotePathPhoto, Imaging.ImageFormat.Jpeg)
stream.Close()
bitmap.Dispose()
Catch ex As Exception
Throw New Exception(ex.Message)
End Try
End Sub |
Lorsque j'executye cette fonction, j'ai le message d'erreur suivant :
Une erreur s'est produite : Une erreur générique s'est produite dans GDI+.
Je le reçoit à cette ligne :
bitmap.Save(RemotePathPhoto, Imaging.ImageFormat.Jpeg)
Avez-vous une idée de ce problème ?
Partager