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
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.

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.