photo gallery

Ask about a PHP problem here.
ExtremeGaming
Posts: 205
Joined: Mon Jul 09, 2012 11:13 pm

Re: photo gallery

Post by ExtremeGaming »

The htmlentities error is indeed gone now :) However, this is what your source code shows:

[syntax=xhtml]<a href="uploads//."><img src="122" title="" />[/syntax]

First, it's not really dealing with your issue but you aren't closing your <a> tag.

Second, You are calling everything within the a href with $image['something']; but the variable $image doesn't exist so it will always return blank. I'm not sure if $images will work but you can give it a try :D In the img src it seems all you are gathering is the id of the image, you also need the url of it
<?php while(!$succeed = try()); ?>
User avatar
Robbedoesie
Posts: 97
Joined: Thu May 19, 2011 7:37 pm
Location: Enkhuizen, Holland

Re: photo gallery

Post by Robbedoesie »

First, it's not really dealing with your issue but you aren't closing your <a> tag.

Thanks, I didn't notice that. I closed it now.

Second, You are calling everything within the a href with $image['something']; but the variable $image doesn't exist so it will always return blank. I'm not sure if $images will work but you can give it a try :D In the img src it seems all you are gathering is the id of the image, you also need the url of it

You mean to change all the $image in $images? I did that but unfortunately, no changes. It now looks like this;
[syntax=php]$full_image=(isset($_GET['image_id'])) ? $_GET['image_id'] : $images[0];
if (isset($image)) {
echo'<a href="uploads/',$image['album'], '/', $image['id'], '.', $image['ext'], '">
<img src="',$full_image, '" title="" /></a>';
} else {
echo 'Er zijn nog geen foto\'s geupload';
}[/syntax]
I tried to set the image variable, but it doesn't make any changes. I also removed the htmlentities. Now in the page source this message shows up; <b>Notice</b>: Array to string conversion in <b>/data/home/ect. on line 104, that is this part;[syntax=php]<img src="',$full_image, '" title="" /></a>';[/syntax]
All what I tried with the implode function didn't work.
User avatar
Robbedoesie
Posts: 97
Joined: Thu May 19, 2011 7:37 pm
Location: Enkhuizen, Holland

Re: photo gallery

Post by Robbedoesie »

I'm still busy trying to get an image in the image container when opening the view_album.php page, butt with no success at all. It is the last hurdle for this page but I'm not sure anymore if it is possible to get over this hurdle. Am I maybe trying to achieve something that can't be done?

The message;<b>Notice</b>: Array to string conversion in <b>/ect. is still showing up, but could that message show up because it's finding no letters and/or numbers?

The variable image['something'] in the image container seems to be different than the image['something'] variable in the foreach loop in the sidebarleft container. Nothing shows up in the source code(data from the album foreach loop can be found :?). However, when I click on a thumbnail an image shows up. So I don't think that is the problem(but I am not sure) but the $images[0] is maybe the problem. Could it be that the images variable in the image container is not the same variable as the images variable in the sidebarleft container? That they don't match with each other?

view_album.php;
[syntax=php]<?php
include 'core/init.php';

if (isset($_GET['album_id'])) {
$album_id = $_GET['album_id'];
$album_data = album_data($album_id, 'name', 'description');

echo '<h3>', $album_data['name'], '</h3><p>', $album_data['description'], '</p>';

$albums = get_albums();
$images = get_images($album_id);
}
?>
<body>
<div id="wrap">
<div id="sidebarleft">
<?php

if (empty($images)) {
echo 'Er zijn geen foto\'s in dit album';
} else {
foreach ($albums as $album) {
$image = true;
foreach ($images as $image) {
echo'<a href="view_album.php?album_id=', $album['id'],'&image_id=uploads/', $image['album'], '/', $image['id'], '.', $image['ext'], '"><img src="uploads/thumbs/', $image['album'], '/', $image['id'], '.', $image['ext'], '" title="" /></a><a href="delete_image.php?image_id=', $image['id'],'">x</a> ';
$image = false;
}
if(!$image) break;
}
}
?>
</div>
<div id="imagecontainer">
<div id="image">
<?php
$full_image=(isset($_GET['image_id']))
? $_GET['image_id']
: $images[0];
if(isset($image)){
echo'<a href="?image_id=uploads/', $image['album'], '/', $image['id'], '.', $image['ext'], '">
<img src="',$full_image, '" title="" /></a>';
} else {
echo 'Er zijn geen foto\'s in dit album';
}
?>
</div>
</div>
<div id="footer">
<?php
include 'template/footer.php';
?>
[/syntax]

http://www.robcnossen.nl/view_album.php?album_id=7

It is a lot of questions, I know, but I am not getting any further on my own so I hope you can help me finding answers and hopefully helping solve this problem...
User avatar
FrederickGeek8
Posts: 148
Joined: Wed Nov 30, 2011 10:31 pm

Re: photo gallery

Post by FrederickGeek8 »

It says that the array-to-string conversion is at line 106. Is there a 106? Did you post the full file?
User avatar
Robbedoesie
Posts: 97
Joined: Thu May 19, 2011 7:37 pm
Location: Enkhuizen, Holland

Re: photo gallery

Post by Robbedoesie »

No, I let out the css.
Line 106 is [syntax=php]<img src="',$full_image, '" title="" /></a>';[/syntax] and $full_image is;
[syntax=php]$full_image=(isset($_GET['image_id'])) ? $_GET['image_id'] : $images[0];[/syntax]
ExtremeGaming
Posts: 205
Joined: Mon Jul 09, 2012 11:13 pm

Re: photo gallery

Post by ExtremeGaming »

If image_id is not set in the url you are using a string to process an array which is why you get the error. If you fix that, the image seems to show correctly as seen in: http://www.robcnossen.nl/view_album.php ... /7/122.jpg

The real problem is with the <a href> I believe you need to use a foreach for that as well
<?php while(!$succeed = try()); ?>
User avatar
Robbedoesie
Posts: 97
Joined: Thu May 19, 2011 7:37 pm
Location: Enkhuizen, Holland

Re: photo gallery

Post by Robbedoesie »

I am trying to get this problem fixed with the foreach loop but I have to work more with this. This can take a while because I have to work and it is busy in the these coming days.
I let you Know if I get this working or not.

I am this far now with the foreach loop;
[syntax=php]if (isset($images))
foreach ($albums as $album) {
$image = true;
{
foreach ($images as $image) {
$full_image=(isset($_GET['image_id'])) ? $_GET['image_id'] : $images[0];
echo'<a href="view_album.php?album_id=', $album['id'],'&image_id=uploads/', $image['album'], '/', $image['id'], '.', $image['ext'], '">
<img src="',$full_image, '" title="" /></a>';
$image = false;
}
if(!$image) break;
}
}else{
echo 'Er zijn geen foto\'s in dit album';
}
[/syntax]
Problem is that all the images(in this case only two) are showing up in the main image container instead of one.
ExtremeGaming
Posts: 205
Joined: Mon Jul 09, 2012 11:13 pm

Re: photo gallery

Post by ExtremeGaming »

You can try changing it back to the way it was, then do print_r($images); somewhere, then source directly from the array with $images[value]

Example would be:

[value1] => something [value2] => something else

[syntax=php]
<?php

echo "Value 1 is equal to ". $images['value1'];

?>
[/syntax]
<?php while(!$succeed = try()); ?>
User avatar
Robbedoesie
Posts: 97
Joined: Thu May 19, 2011 7:37 pm
Location: Enkhuizen, Holland

Re: photo gallery

Post by Robbedoesie »

I did the var_dump on $images, this shows up;
array(2) { [0]=> array(5) { ["id"]=> string(3) "122" ["name"]=> string(38) "KONICA MINOLTA DIGITAL CAMERA_1043.jpg" ["album"]=> string(1) "7" ["timestamp"]=> string(10) "1355299786" ["ext"]=> string(3) "jpg" } [1]=> array(5) { ["id"]=> string(3) "123" ["name"]=> string(37) "KONICA MINOLTA DIGITAL CAMERA_454.jpg" ["album"]=> string(1) "7" ["timestamp"]=> string(10) "1356040162" ["ext"]=> string(3) "jpg" } }.
I did the same on $full_image and then this shows up;
array(5) { ["id"]=> string(3) "122" ["name"]=> string(38) "KONICA MINOLTA DIGITAL CAMERA_1043.jpg" ["album"]=> string(1) "7" ["timestamp"]=> string(10) "1355299786" ["ext"]=> string(3) "jpg" }.
That looks alright to me, I mean, this can't be convert to a string because it is all already a string.

If I understood you correctly I had to search for the value like this;
[syntax=php]echo "Value 1 is equal to ". $images[1];[/syntax], I did that and than this shows up, "Notice: Array to string conversion in /ect". So the problem is maybe the $images variable?

Could it be that the get_images function is a part of the problem?
[syntax=php]function get_images($album_id) {
$album_id = (int)$album_id;

$images = array();

$image_query = mysql_query("SELECT `image_id`, `image_name`, `album_id`, `timestamp`, `ext` FROM `images` WHERE `album_id`=$album_id");
while ($images_row = mysql_fetch_assoc($image_query)) {
$images[] = array(
'id' => $images_row['image_id'],
'name' => $images_row['image_name'],
'album' => $images_row['album_id'],
'timestamp' => $images_row['timestamp'],
'ext' => $images_row['ext']
);
}
return $images;
}[/syntax]
Or do I make it more complex than it is already?
ExtremeGaming
Posts: 205
Joined: Mon Jul 09, 2012 11:13 pm

Re: photo gallery

Post by ExtremeGaming »

Hmm...I'm not too familiar with array to string conversion errors, or arrays using this method in general. But this is what it should look like, somewhat. Do not worry about the number values in the array, just ignore those and look at all other values within brackets
[syntax=php]
// You should change the value for $images['0']. If $_GET['image_id'] is not set I think it will give an error/notice about array to string conversion
$full_image=(isset($_GET['image_id']) ? $_GET['image_id'] : $images['0']);
if(isset($image)){
echo'<a href="?image_id=uploads/', $images['album'], '/', $images['id'], '.', $images['ext'], '">
<img src="',$full_image, '" title="" /></a>';
}[/syntax]

Robbedoesie wrote:If I understood you correctly I had to search for the value like this;
[syntax=php]echo "Value 1 is equal to ". $images[1];[/syntax], I did that and than this shows up, "Notice: Array to string conversion in /ect". So the problem is maybe the $images variable?


The value inside the brackets ( [ and ] ) should correspond to the values in your array. So $images['id'], $images['name'], $images['album'], etc. If you still have issues, please post the new code you have tried so we know what we're dealing with :)
<?php while(!$succeed = try()); ?>
User avatar
Robbedoesie
Posts: 97
Joined: Thu May 19, 2011 7:37 pm
Location: Enkhuizen, Holland

Re: photo gallery

Post by Robbedoesie »

The code is now like this;
[syntax=php]$full_image=(isset($_GET['image_id']) && (isset($_GET['id'])))
? $_GET['image_id']
: $images['id'];
var_dump($full_image);

if(isset($image)){
echo'<a href="?image_id=uploads/', $image['album'], '/', $image['id'], '.', $image['ext'], '">
<img src="',$full_image, '" title="" /></a>';
} else {
echo 'Er zijn geen foto\'s in dit album';
}[/syntax]
I got a this message;Notice: Undefined index: id in /ect/, but I did isset['id']. I do also [syntax=php]var_dump($full_image);[/syntax] but the return of this is NULL.

What am I doing wrong here?
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: photo gallery

Post by jacek »

The notice error will be about the other variable with "id", $images['id'] so make sure that is being defined correctly ?

Also a tip on isset(), you can combine them so instead of

[syntax=php]if (isset($var1) && isset($var2)){[/syntax]
you can do

[syntax=php]if (isset($var1, $var2)){[/syntax]
which does the same thing. this means that your line can be

[syntax=php]$full_image = (isset($_GET['image_id'], $_GET['id'])) ? $_GET['image_id'] : $images['id'];[/syntax]
Image
User avatar
Robbedoesie
Posts: 97
Joined: Thu May 19, 2011 7:37 pm
Location: Enkhuizen, Holland

Re: photo gallery

Post by Robbedoesie »

Pfff, I can't get the ['id'] defined correctly. The code is now this;
[syntax=php]
//if(isset($images['id'])){
//$images='';
$full_image = (isset($_GET['image_id'], $_GET['id']))
? $_GET['image_id'] : $images['id'];
//print_r($full_image);
var_dump($full_image);
echo'<a href="?image_id=uploads/', $image['album'], '/', $image['id'], '.', $image['ext'], '">
<img src="',$full_image, '" title="" /></a>';
//}
[/syntax]
Also the images variable is not defined correctly.

How can I define this all correctly, what is wrong with define it like this? Or how can I get that the array don't have to convert to a string, because [syntax=php]$images[0][/syntax] returns the right data but I can't display it.
User avatar
Robbedoesie
Posts: 97
Joined: Thu May 19, 2011 7:37 pm
Location: Enkhuizen, Holland

Re: photo gallery

Post by Robbedoesie »

I can't define 'id' correctly.
Can the get_images function
[syntax=php]function get_images($album_id) {
$album_id = (int)$album_id;

$images = array();

$image_query = mysql_query("SELECT `image_id`, `image_name`, `album_id`, `timestamp`, `ext` FROM `images` WHERE `album_id`=$album_id");
while ($images_row = mysql_fetch_assoc($image_query)) {
$images[] = array(
'id' => $images_row['image_id'],
'name' => $images_row['image_name'],
'album' => $images_row['album_id'],
'timestamp' => $images_row['timestamp'],
'ext' => $images_row['ext']
);
}
return $images;
}[/syntax]only be reached with the $image variable and not with the $images variable? So maybe $images['id'] is not existing at all and can't be defined?

http://www.robcnossen.nl/view_album.php?album_id=7
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: photo gallery

Post by jacek »

The problem seems to be that $images is not given a value before you try to use $images['id'] it could be that you need to assign the result of the function get_images() to this like

[syntax=php]$images = get_inages($album_id);[/syntax]
Basically you need to follow the variable back from the error until you find where it's defined, or that it's not defined.

Could you post all of the files as they are now and I will try to make sense of it.
Image
User avatar
Robbedoesie
Posts: 97
Joined: Thu May 19, 2011 7:37 pm
Location: Enkhuizen, Holland

Re: photo gallery

Post by Robbedoesie »

Oke, here this are all the files;
image.func.php;
[syntax=php]<?php
ini_set('display_errors',1);
error_reporting(E_ALL);

function get_images($album_id) {
$album_id = (int)$album_id;

$images = array();

$image_query = mysql_query("SELECT `image_id`, `image_name`, `album_id`, `timestamp`, `ext` FROM `images` WHERE `album_id`=$album_id");
while ($images_row = mysql_fetch_assoc($image_query)) {
$images[] = array(
'id' => $images_row['image_id'],
'name' => $images_row['image_name'],
'album' => $images_row['album_id'],
'timestamp' => $images_row['timestamp'],
'ext' => $images_row['ext']
);
}
return $images;
}
?>[/syntax]
I reduced this file to only the get_images function because from this file I use only the get_images function in the view_album.php file.

album.func.php;
[syntax=php]<?php
function album_data($album_id) {
$album_id = (int)$album_id;

$args = func_get_args();
unset($args[0]);
$fields = '`'.implode('`, `', $args).'`';

$query = mysql_query("SELECT $fields FROM `albums` WHERE `album_id`=$album_id");
$query_result = mysql_fetch_assoc($query);
foreach ($args as $field) {
$args[$field] = $query_result[$field];
}
return $args;
}

function get_albums() {
$albums = array();

$albums_query = mysql_query("SELECT `albums`. `album_id`, `albums`.`timestamp`, `albums`.`name`, LEFT(`albums`.`description`, 50) as `description`, COUNT(`images`. `image_id`) as `image_count`
FROM `albums`
LEFT JOIN `images`
ON `albums`.`album_id` = `images`.`album_id`
GROUP BY `albums`.`album_id`
");

while ($albums_row = mysql_fetch_assoc($albums_query)) {
$albums[] = array(
'id' => $albums_row['album_id'],
'timestamp' => $albums_row['timestamp'],
'name' => $albums_row['name'],
'description' => $albums_row['description'],
'count' => $albums_row['image_count']
);
}

return $albums;
}
?>[/syntax]
I reduced this file to only the album_data function and get_images function because from this file I use only these functions in the view_album.php file. I think it makes it more easy-view for you. If you want the rest of it let me know.

view_album.php;
[syntax=php]<?php
include 'core/init.php';

if (isset($_GET['album_id'])) {
$album_id = $_GET['album_id'];
$album_data = album_data($album_id, 'name', 'description');

echo '<h3>', $album_data['name'], '</h3><p>', $album_data['description'], '</p>';

$albums = get_albums();
$images = get_images($album_id);

}
?>
<div id="wrap">
<div id="sidebarleft">
<?php

if (isset($images)) {

foreach ($albums as $album) {
$image = true;
foreach ($images as $image) {
echo'<a href="view_album.php?album_id=', $album['id'],'&image_id=uploads/', $image['album'], '/', $image['id'], '.', $image['ext'], '"><img src="uploads/thumbs/', $image['album'], '/', $image['id'], '.', $image['ext'], '" title="" /></a><a href="delete_image.php?image_id=', $image['id'],'">x</a> ';
$image = false;
}
if(!$image) break;

}
}else {echo 'Er zijn geen foto\'s in dit album';
}
?>
</div>
<div id="imagecontainer">
<div id="image">
<?php
if(isset($_GET['image_id'])){
echo'<a href="?image_id=uploads/', $image['album'], '/', $image['id'], '.', $image['ext'], '">
<img src="',htmlentities($_GET['image_id']), '" title="" /></a>';
}else if(isset($_GET['id'])){
$full_img = $images['id'];
print_r($images);
var_dump($full_img);
echo'<a href="?image_id=uploads/', $image['album'], '/', $image['id'], '.', $image['ext'], '">
<img src="',htmlentities($full_img),'" title="" /></a>';
}
?>
</div>
</div>
<div id="footer">
<?php
include 'template/footer.php';
?>
</div>
</div>
[/syntax]
This returns no warnings, notice or errors but also no image, even no returns from print_r() or var_dump().

The $images have a value, but is this only meant for the $image?

Thanks in advance.
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: photo gallery

Post by jacek »

Where you use $image on line 38 above it will not have an array value since you define it as false near the top. I'm not really sure what should be in it's place :/ maybe it should be based on $_GET['image_id'] ? You could keep the value form the loop too, you would just need to use a different variable name.
Image
User avatar
Robbedoesie
Posts: 97
Joined: Thu May 19, 2011 7:37 pm
Location: Enkhuizen, Holland

Re: photo gallery

Post by Robbedoesie »

Ah, you mean [syntax=php]$image = false;[/syntax]. The script created somehow three thumbnails of each image instead of a normal one thumbnail of each image. With $image = false; I could reduce it back to one thumbnail of each image, but it is now also an obstacle. Is there a better way to keep only one thumbnail of each image?

Now the $image variables are changed into $img variables, but I get only notices of undefined indexes which I can't get defined.
The code as it is now is;
[syntax=php]
<?php
if (isset($images)) {

foreach ($albums as $album) {
$image = true;
foreach ($images as $image) {
echo'<a href="view_album.php?album_id=', $album['id'],'&image_id=uploads/', $image['album'], '/', $image['id'], '.', $image['ext'], '"><img src="uploads/thumbs/', $image['album'], '/', $image['id'], '.', $image['ext'], '" title="" /></a><a href="delete_image.php?image_id=', $image['id'],'">x</a> ';
$image = false;
}

if(!$image) break;
}
}else {echo 'Er zijn geen foto\'s in dit album';
}
?>
</div>
<div id="imagecontainer">
<div id="image">
<?php
$img = get_images($album_id);
if(isset($img)){
if(isset($_GET['image_id'])){
$full_img = $_GET['image_id'];
echo'<a href="?image_id=uploads/', $img['album'], '/', $img['id'], '.', $img['ext'], '">
<img src="',htmlentities($_GET['image_id']), '" title="" /></a>';
}else{
if(isset($_GET['image_id'])){
$full_img = $images[0];
print_r($images);
var_dump($full_img);
}
echo'<a href="?image_id=uploads/', $img['album'], '/', $img['id'], '.', $img['ext'], '">
<img src="',htmlentities($full_img),'" title="" /></a>';
}
}[/syntax]
I hope that there is a possibility to get rid of the $image = false; part to get the a href='' part right, and maybe I better create an other function then the get_image function to find the img src='' ?
User avatar
Robbedoesie
Posts: 97
Joined: Thu May 19, 2011 7:37 pm
Location: Enkhuizen, Holland

Re: photo gallery

Post by Robbedoesie »

I changed the code to this;
[syntax=php]<?php
include 'core/init.php';

if (isset($_GET['album_id'])) {
$album_id = $_GET['album_id'];
$album_data = album_data($album_id, 'name', 'description');

echo '<h3>', $album_data['name'], '</h3><p>', $album_data['description'], '</p>';

$albums = get_albums();
$images = get_images($album_id);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<div id="wrap">
<div id="sidebarleft">
<?php

if (isset($images)) {
foreach ($albums as $album) {
echo'<a href="view_album.php?album_id=', $album['id'], '"></a>';
}
foreach ($images as $image)
{
echo'<a href="view_album.php?album_id=', $album['id'],'&image_id=uploads/', $image['album'], '/', $image['id'], '.', $image['ext'], '"><img src="uploads/thumbs/', $image['album'], '/', $image['id'], '.', $image['ext'], '" title="" /></a><a href="delete_image.php?image_id=', $image['id'],'">x</a>
}
}else {echo 'Er zijn geen foto\'s in dit album';
}
?>
</div>
<div id="imagecontainer">
<div id="image">
<?php
if(isset($_GET['image_id'])){
$full_img = $_GET['image_id'];
echo'<a href="?image_id=uploads/', $image['album'], '/', $image['id'], '.', $image['ext'], '">
<img src="',htmlentities($_GET['image_id']), '" title="" /></a>';
}else{
if(isset($_GET['image_id'])){
$full_img = $images[0];
print_r($images);
var_dump($full_img);
}
echo'<a href="?image_id=uploads/', $image['album'], '/', $image['id'], '.', $image['ext'], '">
<img src="',htmlentities($full_img),'" title="" /></a>';
}
?>
</div>
</div>
<div id="footer">
<?php
include 'template/footer.php';
?>
</div>
</div>
</body>
</html>[/syntax]
I put the $albums foreach loop separate from the $images foreach loop. It works not bad, there are only one thumbnail showing from one image instead of three thumbnails, when I click one a thumbnail the main image shows nicely up in the main image container. Only the thumbnail part is going to another $album['id']. Is there a solution to stay in the same album after I clicked on a thumbnail?
http://www.robcnossen.nl/view_album.php?album_id=7

I experimented also with array_combine or array_merge ect. I don't think that there is a solution in it, but it is nice to see what it does.
ExtremeGaming
Posts: 205
Joined: Mon Jul 09, 2012 11:13 pm

Re: photo gallery

Post by ExtremeGaming »

Do an array_merge maybe, use print_r(), then source directly from the merged array.
<?php while(!$succeed = try()); ?>
User avatar
Robbedoesie
Posts: 97
Joined: Thu May 19, 2011 7:37 pm
Location: Enkhuizen, Holland

Re: photo gallery

Post by Robbedoesie »

I did the array_merge. The code is now;
[syntax=php]<?php
include 'core/init.php';

if (isset($_GET['album_id'])) {
$album_id = $_GET['album_id'];
$album_data = album_data($album_id, 'name', 'description');

echo '<h3>', $album_data['name'], '</h3><p>', $album_data['description'], '</p>';

$albums = get_albums();
$images = get_images($album_id);
$result = array_merge($images, $albums);
print_r($result);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<div id="wrap">
<div id="sidebarleft">
<?php
if (isset($images)) {

foreach ($albums as $album) {
echo'<a href="view_album.php?album_id=', $album['alb_id'], '"></a>';
}
foreach($images as $image)
{
echo'<a href="view_album.php?album_id=', $album['alb_id'],'&image_id=uploads/', $image['album'], '/', $image['id'], '.', $image['ext'], '"><img src="uploads/thumbs/', $image['album'], '/', $image['id'], '.', $image['ext'], '" title="" /></a><a href="delete_image.php?image_id=', $image['id'],'">x</a> ';
}
}else {echo 'Er zijn geen foto\'s in dit album';
}
?>
</div>
<div id="imagecontainer">
<div id="image">
<?php
$full_image=(isset($_GET['image_id'])) ? $_GET['image_id'] : $images['img_name'];
echo'<a href="?full_img=uploads/', $image['album'], '/', $image['id'], '.', $image['ext'], '"><img src="',htmlentities($full_image), '" title="" />';
?>
</div>
</div>
<div id="footer">
<?php
include 'template/footer.php';
?>
</div>
</div>
</body>
</html>[/syntax]
I try to use the 'img_name' in $images['img_name'] to reach the source. I tried to get this defined but somehow that can't be done.

When I click on a thumbnail the thumbnail parts switch to another album, how can I stay in the same album after clicking on a thumbnail?
http://www.robcnossen.nl/view_album.php?album_id=7
Thanks
Post Reply