Jump to content

Image swap with PHP getimagesize function


Recommended Posts

Not sure if JavaScript or PHP section is right one, my problem is a mixture of both. Hope someone can help...I get the sizes of all my images via the PHP getimagesize function. I also have thumbs with span around to change main image as: <span onmouseover="document.getElementById('rollimg').src=image1.src;">How do I amend:list($width, $height, $type, $attr) = getimagesize("{$mainPath}/{$main1}");which is just before <?php echo '<img src="' . $mainPath . '/'. $row['img1'] . '" ' . $attr . ' alt="Feature Photo" name="rollimg" id="rollimg" />'; ?> to get the relevant $attr for:

image0.src = '<?php echo "{$mainPath}/{$main1}";?>';  image1.src = '<?php echo "{$mainPath}/{$main2}";?>';  image2.src = '<?php echo "{$mainPath}/{$main3}";?>';  image3.src = '<?php echo "{$mainPath}/{$main4}";?>';  image4.src = '<?php echo "{$mainPath}/{$main5}";?>';  image5.src = '<?php echo "{$mainPath}/{$main6}";?>';  image6.src = '<?php echo "{$mainPath}/{$main7}";?>';  image7.src = '<?php echo "{$mainPath}/{$main8}";?>';

I really would appreciate a hint in right direction. SonReason for edit: Spelling mistake, which lead to wrong question

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...