runtime error... memory overload?

startOfNextPhoto = photosTaken * photoLength;

If you anticipate that photosTaken * photoLength will be greater than the value of an int (32,767) then I think you need to tell the compiler to work with long values in the multiplication:

startOfNextPhoto = (long)photosTaken * (long)photoLength;

Otherwise the result of the multiplication will be an int rather than a long.

Of course unless you are using negative numbers you might as well use unsigned ints and unsigned longs.