Jump to content

PDF ezImage and Longblob images


charris1980

Recommended Posts

I am trying to grab an image from the DB, it is a longblob type.  I'm using ezpdf right now, and using ezImage isn't doing anything.  If I use ezText just to see if it grabbed it, then it will display the cryptic text of that longblob.

 

I guess my question is, is there a way to show this longblob image in a PDF?

Link to comment
https://forums.phpfreaks.com/topic/91280-pdf-ezimage-and-longblob-images/
Share on other sites

i think i figured it out.  kind of a weird solution though.

 

create-pdf.php (snip)

                //php code that looks up the image based on ID and displays it.
	$filename = "/show-image.php?image_id=150";

                //copies the image to a .tmp file on the disk.
	copy($filename, "/var/www/temppdfimage.img.jpeg");

                //refreshes the page to the actual ezPDF code that pulls that .tmp file.
	echo "<meta http-equiv=\"refresh\" content=\"0;url=/pdf-test.php?id=58507\">\r\n";

 

seems to work so far anyway.  just have to make the ID's variable _GETs now.  I just hard coded them to test it.

didn't really want to bump this, can't find a edit button.

 

anyway i guess i really over thought this because below worked fine for me

 

create-pdf.php (snip)

	$row = mysql_fetch_array($result);
	$imageurl = "http://www.website.com/show-image.php?imageid=" . $row['image_id'] . "";
	$doc->ezImage($imageurl, '100', '150', 'none', 'right');

 

show-image.php (snip)

	$connection = mysql_connect($host, $user, $pass);
	mysql_selectdb($dbname, $connection);
	$sql = "SELECT image FROM `images_table` WHERE `image_id` = " . $image_id;
	$result = mysql_query($sql, $connection);
	$img = mysql_fetch_row($result);
	print $img[0];

 

just thought i would share...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.