[Gambas-user] [Gambas Bug Tracker] Bug #1044: Gambas should trow an error or at least a warning when loading corrupted images

bugtracker at ...3416... bugtracker at ...3416...
Tue Dec 6 16:20:37 CET 2016


http://gambaswiki.org/bugtracker/edit?object=BUG.1044&from=L21haW4-

Comment #1 by Fabien BODARD:

In fact you can check if "myImage" contain an image object :

Public Sub Form_Open()
  Dim myimage As New Image
  Dim mydata As String
  Dim tmpfile As String = "/tmp/myimage.jpg"
  myimage.Resize(100, 100)
  myimage.Fill(Color.black)
  myimage.Save(tmpfile)
  mydata = File.Load(tmpfile)
  mydata = Left(mydata, Len(mydata) - 100)
  File.Save(tmpfile, mydata)
  Try myimage = Image.Load(tmpfile)
  If Error Then 
    Debug "Error while loading the image"
  Endif

  if not myImage then Debug "Image is not loaded"

End


Is this way solve your problem ?

Fabien BODARD changed the state of the bug to: NeedsInfo.






More information about the User mailing list