The reactions γp → K + and ep → e K + have been investigated in a tree-level effective Lagrangian model that incorporates most of the well-established baryon resonances with spins up to 5 2 , four less well-established nucleon resonances with larger mass, and the K (892) and K1(1270) resonances in the t channel. The off-shell structure of the electromagnetic vertices in electroproduction is incorporated by the addition of electromagnetic form factors. To achieve a good fit to the electroproduction data, it was found necessary to treat the ground-state hyperon form factors as adjustable parameters rather than simply equating them with the neutron form factors as was done in past studies. Photoproduction data consisting of unpolarized differential cross sections from the CLAS Collaboration, hyperon polarization asymmetries from CLAS, GRAAL, and SAPHIR, photon beam asymmetries from GRAAL and LEPS, and double polarization observables from CLAS were fit over the c.m. energy range from threshold up to 2.3 GeV. Electroproduction data for the virtual photoproduction structure functions σ U , σ T , σ L , σ T T , and σ LT from the CLAS collaboration were fit over the K c.m. energy range from threshold up to 2.3 Gev and for several values of q 2 , the square of the virtual photon 4-momentum. For each intermediate resonance included, the fitted parameters in the photoproduction fit consist of the products of the coupling strengths at the electromagnetic and strong interaction vertices. In the electroproduction fit, there were, in addition, two form-factor parameters for each intermediate baryon in the s and u channels and one form factor parameter for each kaon resonance in the t channel. Results are presented for the fitted photoproduction and electroproduction observables and compared with the data for several sets of kinematical variables.