# Margin in pop-up window

**URL:** https://forum.kirupa.com/t/margin-in-pop-up-window/117091
**Category:** Uncategorized
**Created:** [July 24, 2004, 4:46am UTC](https://forum.kirupa.com/t/margin-in-pop-up-window/117091 "2004-07-24T04:46:24Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![vman](https://avatars.discourse-cdn.com/v4/letter/v/5e9695/32.png) [@vman](https://forum.kirupa.com/u/vman)
#### Post date: [July 24, 2004, 4:46am UTC](https://forum.kirupa.com/t/margin-in-pop-up-window/117091/1 "2004-07-24T04:46:24Z")

</div>

Hey Lostinbeta, hope you’re doing well. I saw a thread at [ozzu.com](http://ozzu.com) where you were helping a kid with a marginless window problem. Well, I wanted to get clear on something. I have this image viewer that I’ve been working on  
for my buddie’s band ----\>[http://www.thezplane.com/test/new.htm](http://www.thezplane.com/test/new.htm)  
And I’m supposing the users may want to download some of the pictures from the show. I have a button that opens a window supposedly the size of the the jpeg but there is a white margin on the top and left. Any input on how to get rid of it? I’d appreciate any advise you may have.

```php
on (release) {
getURL("javascript:NewWindow=window.open('Arra/"+_root.count_lv.Pics+"/pic"+_root.picNum+".jpg','newWin','width="+_root.wide+",height="+_root.high+",left=0,top=0,toolbar=0,location=No,scrollbars=No,status=No,resizable=No,fullscreen=No'); NewWindow.focus(); void(0);");
}

```

And thanks for the help earlier in this thread in regards to the loadVars(). It didn’t work the way I had it, but it headed me in the right direction.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 24, 2004, 4:51am UTC](https://forum.kirupa.com/t/margin-in-pop-up-window/117091/2 "2004-07-24T04:51:55Z")

</div>

Well given this is a completely different topic, you probably should have created a new thread for it. Either way, the problem is because you are calling the JPG directly and the browser puts that in it’s own default defined page and you cannot control the margins.

There are 2 options here…

1. Create a .html page for each image that has the HTML margins removed and load that in the pop-up.

2. Create a PHP page that uses a query string to load in the correct image, then call that page (with the right query string identifier) to load in the pop-up window. I personally prefer this method because it is one page that is used for all images.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 24, 2004, 4:57am UTC](https://forum.kirupa.com/t/margin-in-pop-up-window/117091/3 "2004-07-24T04:57:09Z")

</div>

Wow, I was right in the middle of typing up another post saying that I was copying this to a new thread so that someone else may benefit from it and you beat me to it!

Yeah unfortunately I’m not well versed in php. Would it be a fairly simple script that I could find if I did some tutorial searching?

It’s not horrible the way it is but I’m kind of a stickler for little things like this.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 24, 2004, 5:02am UTC](https://forum.kirupa.com/t/margin-in-pop-up-window/117091/4 "2004-07-24T05:02:11Z")

</div>

Well now it’s a new thread 😉

And here’s what I usually use for this sort of thing… the standard margin-remover code applies, so this is just for the PHP Query String IMG thing…

```auto
<?
$img = $_GET["img"];
list($width, $height, $type, $attr) = getimagesize($img);
echo "<img src=\"$img\" NAME=\"galleryImage\" $attr>";
?>

```

And you call the page with something like

```auto
file.php?img=file.jpg

```

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 24, 2004, 5:14am UTC](https://forum.kirupa.com/t/margin-in-pop-up-window/117091/5 "2004-07-24T05:14:13Z")

</div>

no need to declaire img

```php

 #keep it short and simple
 <?
 list($width, $height, $type, $attr) = getimagesize($_GET['img']);
 echo '<img src="'.$_GET['img'].'" NAME="galleryImage" $attr>';
 ?>
 

```

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 24, 2004, 5:21am UTC](https://forum.kirupa.com/t/margin-in-pop-up-window/117091/6 "2004-07-24T05:21:13Z")

</div>

good point. this was a small chunk of a larger script i wrote… you probably don’t even need that whole list/$attr crap in there either… I needed that for javascript purposes… but it is always good to have that defined in the HTML anyway IMO.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 24, 2004, 2:33pm UTC](https://forum.kirupa.com/t/margin-in-pop-up-window/117091/7 "2004-07-24T14:33:45Z")

</div>

Sorry if I sound stupid here but, where would I put this?

```auto
 popup.php?img=file.jpg 

```

And am I supposed to replace file with

```auto
"Arra/"+_root.count_lv.Pics+"/pic"+_root.picNum+".jpg"

```

?

Does the code on the button remain the same? Obviously I’m a little confused.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 24, 2004, 3:11pm UTC](https://forum.kirupa.com/t/margin-in-pop-up-window/117091/8 "2004-07-24T15:11:54Z")

</div>

All you do is change

```auto
"Arra/"+_root.count_lv.Pics+"/pic"+_root.picNum+".jpg"

```

to

```auto
"pop-up.php?img=Arra/"+_root.count_lv.Pics+"/pic"+_root.picNum+".jpg"

```

---

<div class="post-metadata">

### Author: ![vman](https://avatars.discourse-cdn.com/v4/letter/v/5e9695/32.png) [@vman](https://forum.kirupa.com/u/vman)
#### Post date: [July 24, 2004, 7:07pm UTC](https://forum.kirupa.com/t/margin-in-pop-up-window/117091/9 "2004-07-24T19:07:54Z")

</div>

Ok, I still may be confused here because I’m not having any success. This is the popup.php code (just as you gave it to me):

```php
 <?
list($width, $height, $type, $attr) = getimagesize($_GET['img']);
echo '<img src="'.$_GET['img'].'" NAME="galleryImage" $attr>';
?> 

```

This is in the same directory as the .swf.

This is the code I have on my button:

```php
 on (release) {
getURL("popup.php?img=Arra/"+_root.count_lv.Pics+"/pic"+_root.picNum+".jpg")
} 

```

I tried it in conjunction with the javascript as well and that didn’t work either. The above works, but it opens a full size window and not a separate one either.

---

<div class="post-metadata">

### Author: ![lostinbeta](https://avatars.discourse-cdn.com/v4/letter/l/db5fbb/32.png) [@lostinbeta](https://forum.kirupa.com/u/lostinbeta)
#### Post date: [July 24, 2004, 7:17pm UTC](https://forum.kirupa.com/t/margin-in-pop-up-window/117091/10 "2004-07-24T19:17:20Z")

</div>

I said to replace just

```auto
Arra/"+_root.count_lv.Pics+"/pic"+_root.picNum+".jpg

```

with the new line… since that is the URL to the file you are opening. You replaced your whole getURL code, including the window.open() function required to open the pop-up.

---

<div class="post-metadata">

### Author: ![vman](https://avatars.discourse-cdn.com/v4/letter/v/5e9695/32.png) [@vman](https://forum.kirupa.com/u/vman)
#### Post date: [July 24, 2004, 7:24pm UTC](https://forum.kirupa.com/t/margin-in-pop-up-window/117091/11 "2004-07-24T19:24:35Z")

</div>

I said I tried that

> I tried it in conjunction with the javascript as well and that didn’t work either.

This is what I have on the button currently and the window still has the margins.

```auto
 on (release) {
 getURL("javascript:NewWindow=window.open('popup.php?img=Arra/"+_root.count_lv.Pics+"/pic"+_root.picNum+".jpg','newWin','width="+_root.wide+",height="+_root.high+",left=0,top=0,toolbar=0,location=No,scrollbars=No,status=No,resizable=No,fullscreen=No'); NewWindow.focus(); void(0);");
} 

```

So what am I doing wrong? Do I need to take the width=, height= out or something?

---

<div class="post-metadata">

### Author: ![vman](https://avatars.discourse-cdn.com/v4/letter/v/5e9695/32.png) [@vman](https://forum.kirupa.com/u/vman)
#### Post date: [July 24, 2004, 7:27pm UTC](https://forum.kirupa.com/t/margin-in-pop-up-window/117091/12 "2004-07-24T19:27:46Z")

</div>

When I view the source for the pop-up, this is what I’m seeing.

```auto
<img src="Arra/pics1/pic4.jpg" NAME="galleryImage" $attr> 

```

Do those variable in the php need to be defined in Flash somewhere?

---

<div class="post-metadata">

### Author: ![vman](https://avatars.discourse-cdn.com/v4/letter/v/5e9695/32.png) [@vman](https://forum.kirupa.com/u/vman)
#### Post date: [July 24, 2004, 8:43pm UTC](https://forum.kirupa.com/t/margin-in-pop-up-window/117091/13 "2004-07-24T20:43:06Z")

</div>

Ok, I got it worked out. I apologize for being such a bonehead here. I started with learning Flash so I’m almost a complete novice with other languages including html.

So what I didn’t know was that I had to create a page in dreamweaver with all margins set to 0 and put the php script in _it_ and save that with a php extension.

I just had a plain text file saved with a php extension.

Thanks for everything Lostinbeta. You too ol4pr0. Have a great weekend!

---

<div class="post-metadata">

### Author: ![lostinbeta](https://avatars.discourse-cdn.com/v4/letter/l/db5fbb/32.png) [@lostinbeta](https://forum.kirupa.com/u/lostinbeta)
#### Post date: [July 25, 2004, 4:53am UTC](https://forum.kirupa.com/t/margin-in-pop-up-window/117091/14 "2004-07-25T04:53:12Z")

</div>

Yeppers, thats exactly what had to be done. Glad you got it all sorted out.
