I have a web app that takes a photo using the Pi camera and then loads it into the page for display. It works if I use a png file but crashes if the file is jpg.
I have run exiftool on the jpg file and it reports
Compression : JPEG (old-style)
Could this be an issue? Is Xojo not able to recognise this compression?
I need jpegs rather than pngs because they contain exposure data and pngs do not.
It must be something more subtle than the compression format. The following code run as a desktop app successfully opens and displays the image in an image well on both Mac and Raspberry Pi.
Dim f As FolderItem
Dim p As Picture
#If TargetLinux Then
f = New FolderItem("test.jpg", FolderItem.PathTypeNative)
#Else
f = New FolderItem("/Volumes/PiProjects/SkyCamImages/test.jpg", FolderItem.PathTypeNative)
#EndIf
If f = Nil Then
MsgBox("FolderItem is Nil.")
End If
If Not f.exists Then
MsgBox("Image not found at " + f.NativePath)
End If
MsgBox("About to open the image.")
If f <> Nil And f.Exists Then
p = Picture.Open(f)
MsgBox("Image Opened")
image.Image = p
Else
MsgBox("Image not located.")
End If
I’ve tried using the same code in a web app. For simplicity I commented out the line image.Image = p.
Running it in the IDE on the Mac works fine. When I build it, transfer it to The Pi is starts up fine and displays the page. However, as soon as a click the button which fires the code I get the following error:
./WebTestJpg: symbol lookup error: /home/pi/Xojo/SkyCamImages/WebTestJpg Libs/XojoConsoleFrameworkARM.so: undefined symbol: gdImageCreateFromJpeg
Have I forgotten to do something to make this work properly?
Ok, that seems to be where the error is occurring. I had my original app running as a Daemon and it was crashing without any error message that I could find. Perhaps I wasn’t looking in the right places. However, running it as a normal web app it crashes out with the message:
The fact that this image opens just fine in a console app on my mac means one of two things. Either it’s a bug in our framework or a limitation in the library that we use.
Just out of curiosity, what version of Xojo are you using?
Yeah, I found I could open it fine in on a Mac from both a desktop app and a web app. It also opened ok in a Raspberry Pi desktop app but it throws the undefined symbol error as a Raspberry Pi web app.
I’m using 2017r3 because the app crashes almost immediately if I build it with a later version. I’m not sure why that happens but I thought might be because the app also uses the gpio - although I haven’t proven that to be the cause.
Looking at Feedback, we updated the version of LibGD that we linked against in 2018r1 which should fix this jpg problem you are having. Maybe we should isolate why your app is crashing with newer versions instead.
I still think 208R2 has problems with web apps on the Raspberry Pi so I have generally avoided it.
For example, this simple web app, with just a button and a label, works fine if built under 2017R3 but if I build it with 2018R2 it just jumps to 100% cpu and any attempt to load the page just stalls in the browser.