fancybox and dynamic php image pulled from mysql

366 views
Skip to first unread message

thetonyleone

unread,
Nov 29, 2010, 7:02:01 PM11/29/10
to fancybox
Hello all,

I had tried to read through the first say 10 pages of searches on php
for a solution and tried everything that was offered and I am still
coming up dry. First off I can get fancybox to work perfect when it is
pointed to a regular image. I have a client that would like a certain
background behind that image and thus I am trying to open that image
in a php script of a page. I have tried passing the object id and re-
pulling information from mysql or just sending the file names directly
to the page. When i open the page by itself it opens perfect in a
browers but will either show "The requested content cannot be loaded.
Please try again later." or a long thing white box with no image until
I click out of it and on it again then it will open. It seems that
when I try to set the type to image it says it cannot be found. though
the images are png files???

You can see it here:
http://derbyskulz.leonegraphics.com/portfolia.php
and this is what should be loading in fancy
http://derbyskulz.leonegraphics.com/portimage.php?id=1


I have tried changing the type to image:
<script type="text/javascript" src="includes/fancybox/
jquery-1.4.3.min.js"></script>
<script type="text/javascript" src="includes/fancybox/
jquery.fancybox-1.3.4.pack.js"></script>
<link rel="stylesheet" href="includes/fancybox/
jquery.fancybox-1.3.4.css" type="text/css" media="screen" />
<script type="text/javascript">
$(document).ready(function() {
$("a.grouped_elements").fancybox({'type' : 'image'});
});
</script>

and tried changing the php page all around and nothing seems to work:

code from main page:
while ($row = mysql_fetch_array ($result)){
?>
<div class="productbox" align="center">
<a class="grouped_elements" href="portimage.php?id=<?PHP echo
$row['id']; ?>"><img style="background:url(thumb/<?PHP echo
$row['backImage']; ?>) no-repeat;" border="0" src="thumb/<?PHP echo
$row['image']; ?>" /></a>

</div>
<?PHP
//ending for loop for products on a page
}




PHP page:
<?PHP
include 'includes/dbconnect.php';


$id = $_GET['id'];

$query = "SELECT * FROM portfolio
WHERE active = '1'
AND id = '$id'";
$result= mysql_query($query);

while ($row = mysql_fetch_array ($result)){

$back = $row['backImage'];
$image = $row['image'];

}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="image/png"/>
</head>
<body style="margin:0px 0px 0px 0px;">
<img style="background:url(large/<?PHP echo $back; ?>) no-repeat;"
src="large/<?PHP echo $image; ?>">
</body>
</html>

JFK

unread,
Nov 30, 2010, 1:51:06 AM11/30/10
to fancybox
http://groups.google.com/group/fancybox/browse_thread/thread/f75a88d7dd30c071/

On Nov 29, 4:02 pm, thetonyleone <thetonyle...@gmail.com> wrote:
> Hello all,
>
> I had tried to read through the first say 10 pages of searches on php
> for a solution and tried everything that was offered and I am still
> coming up dry. First off I can get fancybox to work perfect when it is
> pointed to a regular image. I have a client that would like a certain
> background behind that image and thus I am trying to open that image
> in a php script of a page. I have tried passing the object id and re-
> pulling information from mysql or just sending the file names directly
> to the page. When i open the page by itself it opens perfect in a
> browers but will either show "The requested content cannot be loaded.
> Please try again later." or a long thing white box with no image until
> I click out of it and on it again then it will open. It seems that
> when I try to set the type to image it says it cannot be found. though
> the images are png files???
>
> You can see it here:http://derbyskulz.leonegraphics.com/portfolia.php
> and this is what should be loading in fancyhttp://derbyskulz.leonegraphics.com/portimage.php?id=1

thetonyleone

unread,
Nov 30, 2010, 11:36:39 AM11/30/10
to fancybox
I read through both of those posts and i don't know if i don't
understand them or ? (not very good at js).

I have already loaded all the images onto the page that i would like
to show with the php script and i guess my biggest question is, is
there a way to display a larger image in FB with a background image I
define on that page (there will be a different one for every picture
on that page)? Any ideas?

Thanks for the help.

On Nov 29, 10:51 pm, JFK <jfk.d...@gmail.com> wrote:
> http://groups.google.com/group/fancybox/browse_thread/thread/f75a88d7...
Reply all
Reply to author
Forward
0 new messages