View display image BLOB with PHP!
I using..
$consulta = oci_parse($conexao,"select photo from userp where usrph_status = 'A' and id = :didbv");
$didbv = $_POST["id"];
oci_bind_by_name($consulta, ':didbv', $didbv);
oci_execute($consulta, OCI_NO_AUTO_COMMIT);
while (($row = oci_fetch_array($consulta, OCI_ASSOC)) != false) {
$arr = oci_fetch_assoc($consulta);
header("Content-type: image/JPEG");
$result = $arr['PHOTO']->load();
print "<img src='".$arr['PHOTO']."'>";
print $result;
echo $result;
What appears in the result page is:
This image contains errors and can not be displayed.
How to fix this?
- With that content type, you should be sending only binary data, not the HTML "<img" text.
- You have both a print and and echo.
Look at script 105 on p.236 of The Underground PHP and Oracle Manual | Homepage
Similar Messages
-
Displaying Images along with Drill Drown Results
I'm using MS access 2003 as my data base and CF as the web
language. I cannot find a topic in reference to displaying Images
along with Drill down results. My tables in access have a OLE
object included however I am clueless as how i can display the
images with my drill down results. I just cannot find a link that
talked about this issue already. Does anyone have a link to this
forum topic?College Kid wrote:
> I'm using MS access 2003 as my data base and CF as the
web language. I cannot
> find a topic in reference to displaying Images along
with Drill down results.
> My tables in access have a OLE object included however I
am clueless as how i
> can display the images with my drill down results. I
just cannot find a link
> that talked about this issue already. Does anyone have a
link to this forum
> topic?
>
Sorry, no link, but I think you want to be looking at the
<cfimage...>
and|or the <cfcontent...> tags. One or both of these
tags should allow
you to deliver the image from the database to the client.
You are doing this in a bit of an unusual, but not unheard of
way. Most
people just store the image file in a handy directory
accessible to the
web server and then store the name|URL to this image as text
in the
database.
But it is definitly possible to server up binary image data
as well.
Though I have never heard of this in conjunction with MS
Access and 'OLE
objects'. I usually hear this discussed in relation to more
enterprise
database management systems and BLOB [Binary Large OBjects]
data fields. -
Alternative method for displaying images blobs stored in DB
I am trying to use an Application Process as a means to displaying images stored in BLOB columns in my table. And it works except for one problem. The code for my on-demand Application Process is below (the name of the application process is OUTPUT_IMAGE):
DECLARE
l_mime VARCHAR2(255);
l_length NUMBER;
l_file_name VARCHAR2(2000);
lob_loc BLOB;
BEGIN
SELECT photo_mime_type,
photo_blob,
photo_filename,
dbms_lob.getlength(photo_blob)
INTO l_mime,
lob_loc,
l_file_name,
l_length
FROM persons
WHERE id = <b>260</b>;
owa_util.mime_header(nvl(l_mime,'application/octet'), FALSE);
htp.p('Content-length: ' || l_length);
htp.p('Content-Disposition: filename="' || l_file_name || '"');
owa_util.http_header_close;
wpg_docload.download_file(lob_loc);
END;
I can then create HTML like:
<img src="f?p=[my_app_id]:0:[the_session_id]:APPLICATION_PROCESS=OUTPUT_IMAGE">
Which works nicely.
The question/problem is: How can I pass the ID of the record (whose BLOB I want to display) to the Application Process? (In the code above you'll see the value of <b>260</b> is currently hard coded). I thought about tacking on something like "&my_id=xxx' to the end of the URL but doing so prevents the Application Process from even running.<BR/><BR/>
All comments/suggestions much appreciated,<BR/><BR/>
Thanks,
<BR/>
AndyAndrew,
The URL for an Application Process uses the standard f?p syntax.
Try passing your value like this:
< img src="f?p=[my_app_id]:0:[the_session_id]:APPLICATION_PROCESS=OUTPUT_IMAGE:NO::MY_ID:[the value to send]"> You would need to have an item called MY_ID.
Your query could then refer to it as
WHERE id = :MY_ID;
Doug -
Displaying images along with data on downloading from excel
Hi All,
I need to show images along with data in the excel sheet when user clicks downld to excel button. Is there possible way to show the images in excel sheet if, kindly help.
Thanks & Regards
Jaspreet KaurHi Vinod
Basically I have a report which needs to be downloaded to excel sheet. For each record there is a particular image in the first column for ex say my colums are img, desc. Now image column contains an image corresponding to each description. If its a file, a folder image is there; if its a document, a page image is there etc. Now i am can display the data of text fields in the following manner ie label =new Label(0,RowCount, wdContext.nodeVn_PortalExcel().getVn_PortalExcelElementAt(i).getVa_Role(), PortalRoleDataFormat);
PortalReportsheet.addCell(label);
but how do i display the image in the excel sheet?
Is it possible to do so, if so please provide assistance.
Thanks & Regards
Jaspreet Kaur -
Help plz~ URGENT: Display image icon with specific coordinates
I want to view an ImageIcon with specific cooridnate (ie, I know the coordinate of the top left hand corner, and i know the height and the width of the "want to display part")
how can i make it such that it will onli view the part i want?
for example
i want to display say from (40, 40) (left hand corner) to (90,90) (right hand corner)
ImageIcon thePic= new ImageIcon("theimage.jpg");
ImageIcon newPic= new ImageIcon( XXXXXXXXX);
what should i put at the XXXXXXXXXX part?
Thanks in advance!Use getSubImage method of BufferedImage. Something like:
Image originalImage = ImageIO.read(imageFile) ;// see ImageIO API
Image scaledImage = originalImage.getScaledInstance(40.40,90,90);
ImageIcon imageIcon = new ImageIcon(scaledImage);ImageIO.read is overloaded for files, inputStreams and URL's so you can choose how to load it.
I'll leave the rest to you
DB -
How to view the image(blob) to smaller window
Hi Friends,
I am browsing photo data (BLOB) column using SQLDev.
But the display is too big Its not so comfortable to view.
How do I resize the display window to something like 2"x2" ?
Thanks a lotIt all depends on what you are doing. You asked how to resize the window and I said that you can drag the window size to enlarge it to see the photograph. If this is not useful then having an additional column of thumbnail images is an option. I don't know what you are building or what your app is. SQL Developer is a GUI that helps you look at your data. For a blob it provides a window for you to see the image[i] as it is. I typically save images in their original format and in some instance I create thumbnails (http://sueh.visualblogging.com/) Yes, this is a manual process, and yes there are 2 images. In your case this might mean changing the table structure and so not what you are after.
Sue -
Design view in DW CS3 with php ?
I am evaluating DW CS3 having previously used text editors to
create simple php based sites.
I'm having problems understanding if DW can show a design
view of a static php page,that uses include php files to provide
the html code for the top of the page and the bottom of the page.
So something like
<?php include('includes/top.php'); ?>
<div id="main">
<h1>Page under construction</h1>
<div class="page_link"><a href="hw.php"
title="HW">Hardware</a></div>
</div>
<div id="bottom">
<?php include 'includes/bottom.php'; ?>
</body>
</html>
top.php and bottom.php include some standard images/text I'm
using on several pages. They contain standard html.
Would I expect DW to show what this should look like in
design view ? If so how do I get this to work ?> Would I expect DW to show what this should look like in
design view ? If
> so
> how do I get this to work ?
No, DW will not show this page in the way you are hoping.
Why? Because the
page doesn't contain <html>, <head>, or
<body> tags. Sure, you have them in
the include file, but DW won't like that. Must you have those
tags in the
files being included?
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
==================
"tonyb61" <[email protected]> wrote in
message
news:fv4sav$npe$[email protected]..
>I am evaluating DW CS3 having previously used text
editors to create simple
>php
> based sites.
> I'm having problems understanding if DW can show a
design view of a static
> php
> page,that uses include php files to provide the html
code for the top of
> the
> page and the bottom of the page.
> So something like
> <?php include('includes/top.php'); ?>
> <div id="main">
> <h1>Page under construction</h1>
> <div class="page_link"><a href="hw.php"
title="HW">Hardware</a></div>
> </div>
> <div id="bottom">
> <?php include 'includes/bottom.php'; ?>
> </body>
> </html>
>
> top.php and bottom.php include some standard images/text
I'm using on
> several
> pages. They contain standard html.
>
> Would I expect DW to show what this should look like in
design view ? If
> so
> how do I get this to work ?
>
> -
Displaying a Blob with a Dynamic Page
A dynamic page was created where one of the columns on the database table is a BLOB. The following error is received when trying to query the column from the dynamic page:
: Unable to execute query (WWV-10201)
The preference path does not exist:
ORACLE.WEBVIEW.PARAMETERS.1093150906 (WWC-51000
FYI - when running a similar query from a form component, the blob displays fine. This problem occurs only with dynamic page components.Hi,
What version of Portal are you using ??
Have you tried using reports like QBE,Wizard or SQL rfor displaying Intermedia Objects.
Thanks,
Anu -
I use hierarchical keywords a lot. For example, World/Europe/Austria/Tirol/specific location. I sometimes assign only an upper level keyword (example: Austria) to an image when I don't know more specifics. How can I then view only those images that have the tag that I select but not those with sub-levels of this keyword? Exactly like choosing in Folders view to look only at a selected folder but not sub-folders. There might be a complicated way to set up a smart collection that includes a keyword but excludes images with more than this number of keywords, but that would be really labor intensive.
It's easy but quite obscure: In the Library Filter bar, select the Keyword column. Then click the "properties" button on the right and select View: Flat. Now tediously scroll through the list and select the desired keyword:
-
How to Display IMAGE BLOB stored in a table in a html region APEX
Need to know how to display an image stored in a table in a HTML APEX Region.
PleaseHi
Please explain what you mean by it doesn't work?
Are there errors messages, at what point, how far did you get and exactly what did you do????
Please provide more information.
Thanks
Ben -
How to display image uploaded with t:inputFileUpload (Tomahawk) ?
I'm using <t:inputFileUpload> to upload images and i need to show uploaded image after uploading complete.
How to get url to temp file created on server? Is this possible ?
<t:inputFileUpload storage="file" id="file1" value="#{uploadBean.uploadedFile}" required="true" />
<img src="????"/>
public String addFile() {
log.debug("uploadedFile: " + uploadedFile);
if (uploadedFile != null) {
getLog().debug("File type: " + uploadedFile.getContentType());
getLog().debug("File name: " + uploadedFile.getName());
getLog().debug("File size: " + uploadedFile.getSize() + " bytes");
return null;
}You will need a server configured to serve files out of a set directory (e.g. Apache HTTPD server). Then copy the file to that directory upon upload.
-
How to display image in database using html or php
i've try already to work this thing but i can't do it. anyone that can help me or give me any example or reference to resolve my problem to retrieve or display image(blob) from database. hope that all of you help me
Using JHeadstart, you can display a BLOB column from the database in HTML, by way of ADF. Check out the JHeadstart Tutorial at http://www.oracle.com/technology/products/jdev/tips/muench/jhstutorial/index.html to get started, then do the same for your own database tables that include the BLOB column. JHeadstart will take care of rendering it as a file upload or image, depending on the display type you set at the attribute level.
Hope this helps,
Sandra Muller
JHeadstart Team
Oracle Consulting -
Newbie: displaying images
I'm new to working withing ColdFsion and to IIS, and
hopefully this is an easy one for someone here. I have my
ColdFusion pages displaying, but can't display images, even with a
direct URL. Do I need to set something in ColdFusion to allow
images to display? IIS has jpg and gif registered as mime type, do
I need to also register them for the added web site (seems they
would inherit)? Or is something else blocking images that I'm
missing? I'm allowing "Web Services" through the server's firewall
settings, and get no images even with the firewall off, so that's
not it. Maybe a file permissions issue? I've tried a lot of things
and searched for a long time, so thought I'd post in hopes of help
or some direction.
My setup: Windows Server 2003, IIS 6.0, ColdFusion MX
6,1,0,83762, Windows Firewall
Any help greatly appreciated,
EricUnless you are doing something very sophisticated, ColdFusion
has
nothing to say about the displaying of images.
ColdFusion creates the HTML (including any image tags) to be
sent to the
browser as a response to a request. The browser parses this
HTML and
makes any requests for image files it needs to the web
server. The
browser incorporates the delivered image content from the web
server
into the rendered page.
Take a look at the generated HTML code for the page. Post
relevant
parts here if you need help interpreting the code. Most
likely you are
not correctly generating <img ...> tags for some
reason.
P.S. Yes CF can and does do more then HTML responses these
days, but
for this discussion, the HTML response is what is of concern. -
Displaying Images through Servlets
I am using Servletrunner utility to run my servlets. How can I display Images along with other HTML text, to the Browsers through Servlets?
Print out the <img> tag. The URL you use may in turn reference another servlet that produces an image. You can look at the Java2D (and perhaps Java3D, if you want 3D images) to help you produce the images.
-
PHP 5 Code to Upload and Retrieve an Image (aka BLOB) with Oracle
I keep being asked about BLOBs. For posterity, here is my example updated
to use the new PHP 5 OCI8 function names, and using bind variables for the BLOB id.
-- cj
<?php
// Sample form to upload and insert an image into an ORACLE BLOB
// column using PHP 5's OCI8 API.
// Note: Uses the new PHP 5 names for OCI8 functions.
// Before running this script, execute these statements in SQL*Plus:
// drop table btab;
// create table btab (blobid number, blobdata blob);
// This example uploads an image file and inserts it into a BLOB
// column. The image is retrieved back from the column and displayed.
// Make sure there is no whitespace before "<?php" else the wrong HTTP
// header will be sent and the image won't display properly.
// Make sure php.ini's value for upload_max_filesize is large enough
// for the largest lob to be uploaded.
// Tested with Zend Core for Oracle 1.3 (i.e. PHP 5.0.5) with Oracle 10.2
// Based on a sample originally found in
// http://www.php.net/manual/en/function.ocinewdescriptor.php
$myblobid = 1; // should really be a unique id e.g. a sequence number
define("ORA_CON_UN", "hr"); // username
define("ORA_CON_PW", "hr"); // password
define("ORA_CON_DB", "//localhost/XE"); // connection string
if (!isset($_FILES['lob_upload'])) {
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST"
enctype="multipart/form-data">
Image filename: <input type="file" name="lob_upload">
<input type="submit" value="Upload">
</form>
<?php
else {
$conn = oci_connect(ORA_CON_UN, ORA_CON_PW, ORA_CON_DB);
// Delete any existing BLOB so the query at the bottom
// displays the new data
$query = 'DELETE FROM BTAB WHERE BLOBID = :MYBLOBID';
$stmt = oci_parse ($conn, $query);
oci_bind_by_name($stmt, ':MYBLOBID', $myblobid);
$e = oci_execute($stmt, OCI_COMMIT_ON_SUCCESS);
if (!$e) {
die;
oci_free_statement($stmt);
// Insert the BLOB from PHP's tempory upload area
$lob = oci_new_descriptor($conn, OCI_D_LOB);
$stmt = oci_parse($conn, 'INSERT INTO BTAB (BLOBID, BLOBDATA) '
.'VALUES(:MYBLOBID, EMPTY_BLOB()) RETURNING BLOBDATA INTO :BLOBDATA');
oci_bind_by_name($stmt, ':MYBLOBID', $myblobid);
oci_bind_by_name($stmt, ':BLOBDATA', $lob, -1, OCI_B_BLOB);
oci_execute($stmt, OCI_DEFAULT);
// The function $lob->savefile(...) reads from the uploaded file.
// If the data was already in a PHP variable $myv, the
// $lob->save($myv) function could be used instead.
if ($lob->savefile($_FILES['lob_upload']['tmp_name'])) {
oci_commit($conn);
else {
echo "Couldn't upload Blob\n";
$lob->free();
oci_free_statement($stmt);
// Now query the uploaded BLOB and display it
$query = 'SELECT BLOBDATA FROM BTAB WHERE BLOBID = :MYBLOBID';
$stmt = oci_parse ($conn, $query);
oci_bind_by_name($stmt, ':MYBLOBID', $myblobid);
oci_execute($stmt, OCI_DEFAULT);
$arr = oci_fetch_assoc($stmt);
$result = $arr['BLOBDATA']->load();
// If any text (or whitespace!) is printed before this header is sent,
// the text won't be displayed and the image won't display properly.
// Comment out this line to see the text and debug such a problem.
header("Content-type: image/JPEG");
echo $result;
oci_free_statement($stmt);
oci_close($conn); // log off
?>I am using oracle 10g [10.2.0.1.0] and PHP 4.3.9 with Apache.
I tried my best to change the old functions names for example(oci_fetch)
to the new (OCIFetch),i works every where, but i could not find the corresponded functions of (oci_fetch_assoc) that's why i can not see my BLOBS at all!
Can some help me please, to know where are corresponded functions of oracle 8 to oracle 10g?
Exactly here is my problem:
$query = 'SELECT BLOBDATA FROM BTAB WHERE BLOBID = :MYBLOBID';
$stmt = ociparse ($conn, $query);
OCIBindByName($stmt, ':MYBLOBID', $myblobid);
ociexecute($stmt, OCIDEFAULT);
$arr = oci_fetch_assoc($stmt);
// OCIFetchAssoc, OCIFetch, OCI_ASSOC ... nothing works-> Fatal error: Call to undefined function:
$result = $arr['BLOBDATA']->load();
What should i do?
Thanky very much.
Maybe you are looking for
-
Using the Rank() function in 8i
I have a table that holds multiple transactions and amounts for each person (each person uniquely identified by an id). For simplicity's sake, the let's say that the table only has four columns and looks like this: PID NUMBER(8) TID VARCHAR2(10) AMT
-
Firefox Doesn't display correctly and is very laggy on sites with CloudFlare DDoS Protection
Since 35.0 and above i have been getting weird behaviour on sites with CloudFlare DDoS protection. When i open the site in a new window, it takes a really long time and sometimes doesn't display at all and gives me a blank page. and now it just start
-
Issue with "at sign" - @
I have tried to create a databaselink to a SQL SERVER but I'm facing issues with the username. When I use the following command the dblink is created but I am unable to connect to the dblink: CREATE DATABASE LINK mydblink CONNECT TO *"[email protecte
-
Scheduling ASE Data and Log Backup
Hi, Trying to schedule ASE database backup using Sybase control center but it seems SCC version does not have Task management tab in Administration Console. Is it a configuration which is missing or is the version of SCC for which it is not enabled.
-
1120: Access of undefined property sendbtn.
What would cause this I have a button named sendbtn but it causes this error like 4 times