Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to remove X number of bytes from a binary data 1

Status
Not open for further replies.

iteach2

Technical User
Sep 16, 2001
120
US
Hi Gurus,

I have a variable called $content which holds binary data(jpeg image). I want to display the jpeg in a web browser but I have to remove the first 5 bytes from the binary data before it will display properly. How would I remove the first 5 bytes on $content.

Thank you: Heres my code so far.

Code:
<?

//$st = $_REQUEST['searchterm'];
//$ct = $_REQUEST['category'];


	//open connection
	$Connection = OCILogon("user", "pass", "db");

	//create query
	$Query = "SELECT * " . 
	 "FROM BLD b, THN t WHERE b.BLDKEYI = 19 AND t.THNOBJKEYI = 19 " .
	 "AND rownum <=20";
	 
	$Statement = ociparse($Connection, $Query);
    ociexecute($Statement);
    while (OCIFetch($Statement))
    {	 
		//$type = OCIResult($Statement, "THNTYPS");
		$content = OCIResult($Statement, "THNTHNB");
		header("Content-type: image/jpeg");
		//print($type);
		$bcontent = chunk_split($content,5,);
		echo $bcontent;
		exit;
   }		
?>
 
Code:
substr($content, 5);

get the whole content into a variable first, then knock off the starting bytes and then send it to the browser
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top