View Full Version : margin in pop-up window
vman
July 24th, 2004, 12:46 AM
Hey Lostinbeta, hope you're doing well. I saw a thread at 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
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.
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.
lostinbeta
July 24th, 2004, 12:51 AM
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.
vman
July 24th, 2004, 12:57 AM
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.
lostinbeta
July 24th, 2004, 01:02 AM
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...
<?
$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
file.php?img=file.jpg
ol4pr0
July 24th, 2004, 01:14 AM
no need to declaire img
#keep it short and simple
<?
list($width, $height, $type, $attr) = getimagesize($_GET['img']);
echo '<img src="'.$_GET['img'].'" NAME="galleryImage" $attr>';
?>
lostinbeta
July 24th, 2004, 01:21 AM
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.
vman
July 24th, 2004, 10:33 AM
Sorry if I sound stupid here but, where would I put this?
popup.php?img=file.jpg
And am I supposed to replace file with
"Arra/"+_root.count_lv.Pics+"/pic"+_root.picNum+".jpg" ?
Does the code on the button remain the same? Obviously I'm a little confused.
lostinbeta
July 24th, 2004, 11:11 AM
All you do is change
"Arra/"+_root.count_lv.Pics+"/pic"+_root.picNum+".jpg" to
"pop-up.php?img=Arra/"+_root.count_lv.Pics+"/pic"+_root.picNum+".jpg"
vman
July 24th, 2004, 03:07 PM
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):
<?
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:
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.
lostinbeta
July 24th, 2004, 03:17 PM
I said to replace just
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.
vman
July 24th, 2004, 03:24 PM
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.
on (release) {
getURL("javascript:NewWindow=window.open('popup.php?img=Ar ra/"+_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?
vman
July 24th, 2004, 03:27 PM
When I view the source for the pop-up, this is what I'm seeing.
<img src="Arra/pics1/pic4.jpg" NAME="galleryImage" $attr>
Do those variable in the php need to be defined in Flash somewhere?
vman
July 24th, 2004, 04:43 PM
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!
lostinbeta
July 25th, 2004, 12:53 AM
Yeppers, thats exactly what had to be done. Glad you got it all sorted out.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.