Do you have access to external Firewire CD/DVD drive?
Another way is how I installed 10.4 on my Cube that only had a CD-drive. I put the 10.4 install DVD in my iBook and connected it to the Cube with a firewire cable and booted the iBook into Target Mode. Booted the Cube holding down the option key and from the "Bootable FileSystems" selected the install DVD, and then selected "Disk Utility" from the Tools menu (I think it is the screen straight after choosing language) repartitioned the HDD (as APM) and formatted as HFS+ and then installed 10.4 to that partition.
As long as you have access to another Mac with a DVD drive and firewire you should be able to install to the iMac's HDD. Of course this assumes that there is actually nothing wrong with the HDD or HDD controller of the iMac.
Another way is how I installed 10.4 on my Cube that only had a CD-drive. I put the 10.4 install DVD in my iBook and connected it to the Cube with a firewire cable and booted the iBook into Target Mode. Booted the Cube holding down the option key and from the "Bootable FileSystems" selected the install DVD, and then selected "Disk Utility" from the Tools menu (I think it is the screen straight after choosing language) repartitioned the HDD (as APM) and formatted as HFS+ and then installed 10.4 to that partition.
As long as you have access to another Mac with a DVD drive and firewire you should be able to install to the iMac's HDD. Of course this assumes that there is actually nothing wrong with the HDD or HDD controller of the iMac.