.Hi guys i have been working on a picture viewer and what i want to do is put certain informations over the pictures that is retrieved from the database.

i used the following code to retrieve images from the database:

<?php

$host = 'localhost';
$user = '';
$pw = '';
$db = 'dbhere';

mysql_connect($host,$user,$pw); 
mysql_select_db($db); 
$pid = 10;
$sql = "select pics, ext from infopics where id='10'"; 
$result = mysql_query($sql) or die('Bad query at 12!'.mysql_error()); 
while($row = mysql_fetch_array($result,MYSQL_ASSOC))
{
$db_img = $row['pics'];
$type = $row['ext'];
} 
$img = base64_decode($db_img); //print_r($db_img );
$img = imagecreatefromstring($img);
header("Content-Type: image/png");
imagejpeg($img);
imagedestroy($img);
$string = $_GET['text'];
?>

saved as picture.php

.and i used a tag like this on the other php page to fetch the retrieved image from above:

<a id="example8" href="#" title="" ?><img class="last" src="picture.php?text=text" /></a>

.I also placed informations about the pictures on the database which i have retrieved and displayed on my info.php and i want to place it over the image. like on the following link:

http://fancybox.net/

the third one placed on the
Different title positions - 'outside', 'inside' and 'over.

the "over" one.

The title that you will supply on the <a> tag will be the one to be posted over the image. is there a chance that i get the texts from my info.php and place it on the title="" attribute of my <a> tag?

by the way this is the code i used for my info.php:

<?php
$host = 'localhost';
$user = 'root';
$pw = '';
$db = 'thepillar';

mysql_connect($host,$user,$pw); 
mysql_select_db($db); 
$sql = "select name, nickname from infopics where id='1'"; 
$result = mysql_query($sql) or die('Bad query at 12!'.mysql_error()); 
while($row = mysql_fetch_array($result,MYSQL_ASSOC))
{
$name = $row['name'];
$nickname = $row['nickname'];
}
echo "<table style='padding:0px'>
<tr>
<td>
$nickname
</td>
</tr>
<tr>
<td>
$name
</td>
</tr>
</table>";
?>

Recommended Answers

All 4 Replies

hi,
are u using different databases for storing image and their information in another database.
why r using $_GET on line 23 in picture.php. it does not pass variables to next page, instead it tries to retrieve the field with that name

hi,
are u using different databases for storing image and their information in another database.
why r using $_GET on line 23 in picture.php. it does not pass variables to next page, instead it tries to retrieve the field with that name

nope, i'm using the same database for both images and informations. i used $_GET to fetch the image from my picture.php and diplay it on my other pages.

.do you think I've got it all wrong?

.i have successfully retrieved the image from the database and it is already available for preview using my picture.php. but to cut it short, i want to fetch the image from my picture.php to my sample.php and set the image as a target for my <a href""> tag.

help pls!

.ur right that using $_GET was nonsense. i have double checked the code and when i'm containing my sample.php in a <?php ?> tag the image pops out by only using <a href"picture.php"> but when i use only plain html then this code returns a bunch of encrypted codes which i believe is the picture.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.