open(PFILE, ">$photodir") || die "Cannot open image file for writing - $!";