PDA

View Full Version : HELP! image margins within frames.



untitlejk
06-12-2006, 02:15 AM
Basically, I'm targeting an image from one frame to another frame but the image automatically has margins... I'm guessing by default with ie browsers.

From CLICK to TARGET.

http://student.ucr.edu/~kohj02/demo2.jpg

The white area are the margins I want to remove and have the blue box with a black background.

Thanks in advance for any help!

djr33
06-12-2006, 06:20 AM
Please post a link to the page on your site so we can check it out.

Are you linking directly to an image (image.jpg), or a page holding that image (image.htm, etc)?

If you're linking directly to an image, all browsers have their own ways of dealing with images. They'll usually scale them to fit the window, maybe, yes, giving a border.

If you link to a page containig the image, it will solve the problem. Might be a bit more work, though.


However, if your server has php enabled, here's a quick suggestion...
This will make any image you want display on a single webpage, saving you lots of time.
Write your page as it would be normally, being sure to save it as a .php extension.
Then use an image tag like this:

<img src="<?php echo $_GET['image']; ?>">
Be sure not to specify height/width if that is changing. Use an alt attribute that applies to all images, like "selected image", or something.
When linking to that page (for example the link that has the iframe as the target), use this:
href="page.php?image=pathandnameofdesiredimage"
for example, page.php?image=something.jpg
or, even
page.php?image=images/something.jpg

That will save you lots of time. You can use the same page in the iframe for each, and just specificy a different image at the end for each of the links to the frame.

untitlejk
06-12-2006, 10:02 PM
Thanks for your quick response! It works perfectly with your suggestion.


Yet another question..


As you said, I used this code.


<img src="<?php echo $_GET['image']; ?>"></img>



Is there a way to have an image there by default, so when I "call" (click) on another image from another page, it just replaces it? Thanks man, appreciate it.

djr33
06-13-2006, 03:56 AM
I'd do it this way... replace your img tag with this:


<?php
if (!($image=$_GET['image'])) {
$image = "default.jpg";
}
?>
<img src="<?php echo $image; ?>"></img>

I think that will work. I'm not sure what the best way to do an "if not" is... but the exclamation point means not, so... I think if (!(something)) will do for "if not".
See if that works.
If it doesn't, I can write a longer one that will.

untitlejk
06-13-2006, 10:03 PM
Thanks a million, I dont know how I would've figured this out myself. I appreciate your fast and precise help! Thanks again.