How to take and upload a photo using Arduino to arduino I2C , 2 ethernet Sheilds

Im looking to take a photo using TTL serial camera when it check if the mac address of an rfid card is not valid (in database) or not exits.. the master aduino UNO send which connect (rfid module , Ethernet shield , buzzer and leds ) to another aduino UNO (slave) which connect (camera , ethernet shield with sd card).
now my problem in case of invalid mac address (after check in database and return invalid or not found in dB ) master sends a value of "1" on wire to the slave but when the slave get the permission to take the photo . the photo (TEMP.JPG size = 0 kb ) so when i open the brower on (192.168.1.4) it loads index.htm that saved on sd card but the image dont load becouse it's empty.

NOTE: every part in slave working fine alone
1.take a photo
2.upload the photo
but not working together.

Slave_I2C.ino (10.4 KB)

Master_I2C.ino (3.52 KB)

SD Card.zip (754 Bytes)

   Serial.print("\n Integer recieved =");  
  Serial.println(x);         // print the integer

Rubbish. Wire.read() does NOT return an int.

Serial.print() does NOT belong in an ISR.

One letter global names are a BAD idea.

	Serial.end();			// clear all rx buffer
	delay(5);
	Serial.begin(115200);

Why are you calling end() and begin() again? You can ensure that all outgoing serial data has been sent by using Serial.flush().

                    if (webFile) {
                        while(webFile.available()) {
                            client.write(webFile.read()); // send web page to client
                        }
                        webFile.close();
                    }

Sending the file contents in one byte packets is REALLY slow. The read() method is overloaded. So is the write() method. Get more efficient.

// sets every element of str to 0 (clears array)

Which indicates that you don't understand what NULL-terminated means.

Why is the camera connected to the hardware serial port? How do you expect to debug the code that way?