Is this an old iMac with a CD tray that pops out?
Or is it slightly newer, with a slot-loading CD drive?
The reason that I ask - is that 10.4 is easily available on a DVD. There's no old tray-loading iMacs that will read a DVD, which means that you will have several possible challenges to upgrade to 10.4
Without a means to load a DVD, you will need to disassemble the iMac, remove the drive to an external firewire case, and install 10.4 on that hard drive while connected to another, newer Mac. That second Mac can't be too new, because you won't be able to do the install if the newer Mac is an intel model.
You also need to make sure that there's enough RAM memory installed. An older iMac with 10.3.9 - may be able to work with less than 128MB installed. 10.4 needs 256 MB as a minimum. An old iMac may also still have an original hard drive with 6GB, or even 4GB. It's a tough job to figure out how to fit 10.4 on a hard drive that small.
So, first step is to report which iMac you have. The processor speed would help, too.
10.4? eBay is OK, if you make sure that you get a commercial copy, which is on a black-labeled DVD. Stay away from installers on grey disks. Those came in the box with new Macs, and will usually not install on any other model Mac than the one they shipped with.