|
Posted by Michael Martin on 07/25/06 03:26
Not sure on how to do that as I am new to PHP.
m.
"Jerry Stuckle" <jstucklex@attglobal.net> wrote in message
news:u8KdnWjRYouC4VjZnZ2dnUVZ_rSdnZ2d@comcast.com...
> Michael martin wrote:
>> I'm trying to create a picture database for a site that I'm working on
>> and I would like to do the following:
>> - (main goal) Have a php script load an entire directory of photos into
>> my mysql database in one swoop.
>> - Display thumbnails on a general viewing page.
>> - allow for viewing individual pictures by clicking on the thumbnails.
>>
>> <?php
>> error_reporting(E_ALL);
>> $id = $_REQUEST["iid"];
>> $link = mysql_connect("localhost", "root", "") or die("Could not
>> connect: " . mysql_error());
>>
>> mysql_select_db("mysql") or die(mysql_error());
>> $sql = "SELECT b1 FROM t1 where id in (1,2,3)";
>>
>> $result = mysql_query("$sql") or die("Invalid query: " .
>> mysql_error());
>> header("Content-type: image/jpeg");
>>
>> while ($row = mysql_fetch_array($result))
>> {
>> $fileContent = $row['b1'];
>>
>> $im = imagecreatefromstring($fileContent);
>> $width = imagesx($im);
>> $height = imagesy($im);
>> $imgw = 50;
>> $imgh = $height / $width * $imgw;
>> $thumb = ImageCreate($imgw,$imgh);
>>
>>
>> ImageCopyResized($thumb,$im,0,0,0,0,$imgw,$imgh,ImageSX($im),ImageSY($im));
>> ImagejpeG($thumb);
>>
>> imagedestroy ($im);
>> imagedestroy ($thumb);
>> mysql_close ($link);
>> }
>> ?>
>>
>> It is only displaying one image.
>>
>> Thanks
>> M.
>
> You can't do it this way. The content-type header indicates a single
> image will be generated.
>
> You can split this into 2 files - the first one gets the rows and calls
> the second once for each row to display the jpeg.
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstucklex@attglobal.net
> ==================
[Back to original message]
|