A new method for the calculation of photodissociation cross sections