I just noticed your
while(1)
{
...
}
This might be another reason for your problem - see https://community.spark.io/t/known-issue-long-delays-or-blocking-code-kills-the-connection-to-the-cloud/950
When you want to use variables, you’ll need to keep the cloud connection alive.
Have you tried to relay the incoming bytes to Serial and catch them via USB on you PC?
But still try to avoid long running loop() - which might be difficult, when reading 640x400 images at 38400 baud.