It is usually a misunderstanding when questions are asked about the inertial frame of a photon. Photons do not have a rest frame. No particle without a rest mass has a rest frame. When you look at the math, you will end up dividing by zero, and it will lead to infinities.
Now what you could really ask, and what there is in your math, that is how something (traveling near speed c) would look like when viewed from an observer at rest. Now that object that travels near speed c would seem to be contracting as it nears speed c (when viewed from an observer at rest).
To see this, you need to look at the thing very close to the speed of photons. It is very good to look at the frame of a neutrino. The neutrino is as close you can get to the speed of light and as little mass as you can get. When you try to look at a macro object traveling at that speed (of a neutrino) you will figure out from the math that an observer at rest will see the object contract (its length/spatial extension) to close to zero (at a certain axle parallel to the travel direction). You are correct that length contraction will affect this object when viewed from an observer at rest.
Now you are talking about how this object would view the rest of the world from its own reference frame. Now along the axis of travel, you are correct that length contraction would make distances seem close to zero from the reference frame of the object (along the axis of travel).
Now let's look at the time dilation. An object traveling near speed c (if it had a clock with it) would see its own clock tick normal. But let's check what this object would see on its own clock when traveling from the Sun to Earth. Would it see 8 minutes on its own clock? No. It would see an amount of time much less. Close to zero. For an object traveling near speed c, it would seem as the travel from the Sun to Earth took almost no time.
Now when an observer at rest would look at the object travel from the Sun to Earth, the observer would see 8 minutes elapse on its own clock. That is why we say that it takes 8 minutes for a neutrino to reach Earth. That is how much time elapses on the clocks on Earth. But on the neutrino's frame, the clock elapses almost no time.
Now you cannot tell what it would look like from a photon's frame, since it has no rest frame. But you could tell that it should be 8 minutes for the photon to reach Earth. But for the photon, no time passes, it is not moving in the time dimension. For the photon, the spacetime distance from the emission at the Sun to the absorption on Earth is 0. We call this a lightlike worldline. That is why for the photon we could say that it does not experience time as we do (who have rest mass).
Now you could say that for the photon the spacetime distance is 0, we call that lightlike worldline, and that is why we say that spacetime distances (along the axis of travel) for the photon are contracted to 0.