Posted: Sun Apr 03, 2005 6:48 pm
the actual HTML source code that the browser gets.
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
var opera=(navigator.userAgent.indexOf('Opera') != -1) ? true:false;
var operaVer=0;
if (navigator.userAgent.indexOf('Opera ') != -1)
{
operaSplit=navigator.userAgent.split('Opera ');
operaVer=parseInt(operaSplit[1]);
}
else if (navigator.userAgent.indexOf('Opera/') != -1)
{
operaSplit=navigator.userAgent.split('Opera/');
operaVer=parseInt(operaSplit[1]);
}
var opera7=(opera && operaVer >= 7) ? true:false;
var ie5mac=(navigator.platform.indexOf('Mac') != -1 && navigator.userAgent.indexOf('MSIE') != -1) ? true:false;
var dom=(document.getElementById && !opera) ? true:false;
var vertShift=100;
if (opera7) vertShift=200;
function imgPop(imageURL, imageTarget)
{
imageTarget=(imageTarget) ? imageTarget:"_blank";
if ((dom || opera7) && !ie5mac)
{
var imgWin = window.open('about:blank', imageTarget ,'width=200, height=200, left=0, top=0');
with (imgWin.document)
{
writeln('<html><head><title>Loading...</title>');
writeln('<style type="text/css"><!-- body { margin:0px; padding:0px; } --></style></head>');
writeln('<body onload="self.focus();"><img id="pic" style="display:none" /></body></html>');
close();
}
var img = new Image();
img.onload = function() { sizeImgWin(imgWin, img); };
img.src = imageURL;
}
else window.open(imageURL, imageTarget);
}
function sizeImgWin(win, img)
{
var new_w = img.width;
var new_h = img.height;
var old_w = win.innerWidth || win.document.body.offsetWidth;
var old_h = win.innerHeight || win.document.body.offsetHeight;
if (!new_w) { new_w = old_w; }
if (!new_h) { new_h = old_h; }
new_w -= old_w; new_h -= old_h;
win.resizeBy(new_w,new_h);
win.document.title = img.src.substring(img.src.lastIndexOf("/")+1);
var pic = win.document.getElementById('pic');
pic.src = img.src;
pic.style.display = 'block';
sw=screen.width;
sh=screen.height;
var leftPos=((sw-new_w)/2)-100;
var topPos=((sh-new_h)/2)-(vertShift+(((sh-new_h)/2))*0.1);
win.moveTo(leftPos, topPos);
}Code: Select all
<?php
include("config.inc.php");
$result_array = array();
$counter = 0;
$cid = (int)($_GET['cid']);
$pid = (int)($_GET['pid']);
if( empty($cid) && empty($pid) )
{
$number_of_categories_in_row = 2;
$result = mysql_query( "SELECT c.category_id,c.category_name,COUNT(photo_id)
FROM gallery_category as c
LEFT JOIN gallery_photos as p ON p.photo_category = c.category_id
GROUP BY c.category_id" );
while( $row = mysql_fetch_array( $result ) )
{
$result_array[] = "<a href='../data.php?action=gallery&cid=".$row[0]."'>".$row[1]."</a> "." - <font color=\"#000000\"><b>".$row[2]."</b> images</font>";
}
mysql_free_result( $result );
$result_final = "<div align=\"center\"><font class=\"txt\"><strong>Gallery Categories</strong></font></div><br>";
$result_final .= "<tr>\n";
foreach($result_array as $category_link)
{
if($counter == $number_of_categories_in_row)
{
$counter = 1;
$result_final .= "\n</tr>\n<tr>\n";
}
else
$counter++;
$result_final .= "\t<td><div align=\"center\"><font class=\"txt\">".$category_link."</font></div></td>\n";
}
if($counter)
{
if($number_of_categories_in_row-$counter)
$result_final .= "</tr>";
}
}
else if( $cid && empty( $pid ) )
{
$number_of_thumbs_in_row = 3;
if(!isset($_GET['page'])){
$page = 1;
} else {
$page = $_GET['page'];
}
$max_results = 6;
$from = (($page * $max_results) - $max_results);
$result = @mysql_query( "SELECT photo_id,photo_caption,photo_filename FROM gallery_photos WHERE photo_category='".addslashes($cid)."' LIMIT $from, $max_results");
$nr = @mysql_num_rows( $result );
if( empty( $nr ) )
{
$result_final = "\t<tr><td><div align=\"center\"><font class=\"txt\"><strong>No images in category found!</strong>
<br><br><font size=\"2\"><a href='../data.php?action=gallery'>Back to Photo Gallery Category List</a></font>
</div></td></tr>\n";
}
else
{
while( $row = mysql_fetch_array( $result ) )
{
$result_array[] = "<a href='../index.php?pages=gallery&cid=$cid&pid=".$row[0]."'><img src='".$images_dir."/tb_".$row[2]."' border='1' alt='".$row[1]."' /></a>";
}
mysql_free_result( $result );
$result = @mysql_query( "SELECT category_name FROM gallery_category WHERE category_id='".addslashes($cid)."'" );
list($category_name) = mysql_fetch_array( $result );
mysql_free_result( $result );
$result_final = "<tr><div align=\"center\"><b><font class=\"txt\"><a href='../data.php?action=gallery'>Back to Categories</a></b><br><br> Viewing Category \"$category_name\"</b></font></div>";
foreach($result_array as $thumbnail_link)
{
if($counter == $number_of_thumbs_in_row)
{
$counter = 1;
$result_final .= $category_link."\n</tr>\n<tr>\n";
}
else
$counter++;
$result_final .= "\t<td><div align=\"center\"><font class=\"txt\">".$thumbnail_link."</font></div></td>\n";
}
if($counter)
{
if($number_of_photos_in_row)
$result_final .= "\t<td colspan='".($number_of_thumbs_in_row)."'></td>\n";
$result_final .= "</tr>\n";
$total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM gallery_photos WHERE photo_category=".addslashes($cid).""),0);
$total_pages = ceil($total_results / $max_results);
if ($total_pages >1)
{
$result_final .= "<tr><td colspan='".$number_of_thumbs_in_row."'><br><center><font class=\"txt\">Showing Page: ".$page.' of '.$total_pages."</font><center><br>";
if($page > 1){
$prev = ($page - 1);
$result_final .= "\n<font class=\"txt\"><a href=\"../data.php?action=gallery&cid=$cid&page=$prev\" title='Previous Page'><< Prev</a></font>";
}
for($i = 1; $i <= $total_pages; $i++){
if(($page) == $i){
$result_final .= "<font class=\"txt\" color=\"red\"> $i</font>";
} else {
$result_final .= "\n<font class=\"txt\"><a href=\"../data.php?action=gallery&cid=$cid&page=$i\" title='Page ".$i."'>$i</a></font>";
}
}
if($page < $total_pages){
$next = ($page + 1);
$result_final .= "\n<font class=\"txt\"><a href=\"../data.php?action=gallery&cid=$cid&page=$next\" title='Next Page'>Next >></a></font>";
}
$result_final .= "\n</td></tr>";
}
else
{
$result_final .= "<br>\n";
}
}
}
}
else if( $pid )
{
$result = mysql_query( "SELECT photo_caption,photo_filename FROM gallery_photos WHERE photo_id='".addslashes($pid)."'" );
list($photo_caption, $photo_filename) = mysql_fetch_array( $result );
$nr = mysql_num_rows( $result );
mysql_free_result( $result );
if( empty( $nr ) )
{
$result_final = "<tr><td><font class=\"txt\">No Photo found</font></td></tr><br><br>\n";
}
else
{
$result = mysql_query( "SELECT category_name FROM gallery_category WHERE category_id='".addslashes($cid)."'" );
list($category_name) = mysql_fetch_array( $result );
mysql_free_result( $result );
$result_final .= "<tr><td><font class=\"txt\"><center><b><a href='../data.php?action=gallery'>Categories</a></b> -
<a href='../data.php?action=gallery&cid=$cid'><b>Thumbnail Listing</a></b><br><br>
Viewing Category \"$category_name\"<br><br><br><b>Photo caption:<br><br></b>$photo_caption</font><br></center></center></font></td></tr>";
$result_final .= "<tr>\n\t<td align='center'>
<br>
<font class=\"txt\"><img src='".$images_dir."/".$photo_filename."' border='1' alt='".$photo_caption."'>
</td>
</tr><br>";
}
}
echo <<<__HTML_END
<table width='75%' cellspacing='0' cellpadding='5' border='0' bordercolor='' align='center'>
$result_final
</table><br><br>
__HTML_END;
?>Code: Select all
<a href='../data.php?action=gallery&cid=1&pid=1' target='_blank' onclick='imgPop(this.href, this.target); return false;'><img src=../album/photos/tb_1.jpg border='1' alt=Bla></a>Code: Select all
tags where appropriate[/size][/color]Code: Select all
<a href='../data.php?action=gallery&cid=1&pid=1' ..Jim_Bo wrote:Hi ..
OMG ":oops:"
Looks to be correct ..Code: Select all
<a href='../data.php?action=gallery&cid=1&pid=1' target='_blank' onclick='imgPop(this.href, this.target); return false;'><img src=../album/photos/tb_1.jpg border='1' alt=Bla></a>
3 images in the gallery show the correct paths ..
Thanks
Phenom | Please useCode: Select all
tags where appropriate[/size][/color][/quote] so your data.php is in a different directory than the original php script that calls it? if your oringinal php script is in the SAME directory as data.php, then yeah the ../ should be ./ also, look in the href value itself... you have a lot more stuff in the URL itself you really don't need.... Also, one very [b]Final[/b] request... could you post the ENTIRE HTML that is generated when the new window opens? IOW, post the html of the popup window that opens.
Code: Select all
html><head><title>Loading...</title>
<style type="e;text/css"e;><!-- body { margin:0px; padding:0px; } --></style></head>
<body onload="e;self.focus();"e;><img id="e;pic"e; style="e;display:none"e; /></body></html>