Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6609023
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:40:18+00:00 2026-05-25T19:40:18+00:00

Recently i’ve been working on a rather modest application, which lists contacts. When a

  • 0

Recently i’ve been working on a rather modest application, which lists contacts. When a detail-link was clicked, a popup would come up with more details and an image of that contact.
The table this was based on contained a column photo_reference, which held a path to a folder under /i/. With this setup, it was easy to get the images working for each contact.
The popup i showed was a bunch of htmlcode i put in the region footer, and hid.

<div id="contact_popup" class="contact_pop">
   <div class="contact_pop_imgcontainer">
      <img id="id_photo" class="contact_pop" />
   </div> 
</div>

When the detail was clicked, i retrieved data via an application process, and showed a modal dialog of this container.

Now the scope has changed: users need to be able to upload their own images. So, i went to work and made it so the images get uploaded into wwv_flow_files, and then i move them to a new contact_image table. So far so good. But now i want to display these pictures, and here i’m kind of stuck.
* I could include a column in my IR, and put a blob format mask on it with image. I’ve got this working, but annoyingly. My image table has as primary key the field ‘ID’. My contacts table also has ‘ID’ as PK.
Since IMAGE:APXT_CONTACTS_IMG:SMALL_PHOTO:ID::::::inline: specifies ID as the PK, it uses ID from my contacts table.
My link between tables is APXT_CONTACTS.CONTACT_IMAGE_ID -> APXT_CONTACTS_IMG.ID.
The way i might make it work is to rename my id field in the image table to contact_image_id. (why couldnt the format mask just take the column it’s based on as the value :().
I then could hide the column, and take the image with javascript to show in my popup. However, this preloads all images for the amount of selected rows, which isn’t entirely bad, but i’m looking for an alternative first.

  • get_blob_file_src also seems no use to me because of the limited use of the parameters (file browse item, id field), and even then, could i use this through an ajax callback?

  • I’d much rather be able to get the image blob via ajax to then display in my popup, but i have no clue as to how to do this. I’ve made a stored procedure which gets the file to download and call this from an application process (ajax callback), and with firebug i can see the post/response, but i wouldn’t know how to get this displayed as an image.

Javascript:

function cimg(){
   var get = new htmldb_Get(null, &APP_ID., "APPLICATION_PROCESS=get_img", &APP_PAGE_ID.);
   get.addParam('x01', 25);
   var greturn = get.get();
   alert(greturn);
   var pic = new Image();
   pic.onload = function(){
      document.body.appendChild(pic);
   };
   pic.src = greturn;
};

Page process:

begin
   show_small_photo(apex_application.g_x01);
end;

Stored Procedure:

create or replace procedure "SHOW_SMALL_PHOTO"
(p_contact_image_id IN NUMBER)
is
   v_mime      apxt_contacts_img.mime_type%type;
   v_length    NUMBER;
   v_filename  apxt_contacts_img.filename%type;
   v_lob       BLOB;
begin
    SELECT mime_type, lengthb(small_photo), filename, small_photo
    INTO v_mime, v_length, v_filename, v_lob
    FROM apxt_contacts_img
    WHERE id = p_contact_image_id;

    OWA_UTIL.mime_header (NVL (v_mime, 'application/octet'), FALSE);

    HTP.p ('Content-length: ' || v_length);
    -- needed?
    --HTP.p ('Content-Disposition: attachment; filename="'||v_filename||'"');
    OWA_UTIL.http_header_close;
    wpg_docload.download_file (v_lob);
end;

(I’d rather not have to grant execute to public and call the stored procedure via a link.)
This way i’d only have to load the pictures of links clicked. Though this code doesn’t work. I get the alert and see a bunch of those weird chars, so i presume that is the blob talking. But i’m not getting an image anywhere.

Am i missing something? Doing something wrong? I’m totally out of clues.

Instead of my existing code, i might make this work through creating another page, and juggle page items and their values around to try and get the same layout going, and then get that page through ajax?
I’m mainly trying to minimize impact (=work) on the existing app, so i wouldn’t have to yet again change pages.

TL;DR: is it possible to retrieve and display an image blob from a table not in the report query, preferably through ajax?

This is Apex 4.02 on an 11g db

Thanks,
Tom

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T19:40:18+00:00Added an answer on May 25, 2026 at 7:40 pm

    To whom it may concern, here is how i solved/worked around it:

    I went with the fetch-another-page route. Maybe i was too technical or too difficult about it in my op, but in hindsight i think i could’ve boiled it down to:
    “retrieve an image blob via ajax and display it”.
    So if that rings any bells for anyone, let me know.

    Some rectifying too:
    my images table is a child of the contacts table, as such my FK between those is images.contact_id -> contact.id

    I’ve created a new page in my application, and put a form in based on my images table. I only display 2 items of the type ‘display image’ (a thumbnail and original size), and 2 hidden items, ‘ID’ and ‘CONTACT_ID’. I’ve removed all that was not necessary: no buttons, no DML-process, no labels, no templates.
    The automated row fetch process takes as ‘primary key’ my contact id, so i can call the page with contact_id in the url (so that i won’t have to do an extra select to retrieve the correct id in the image table).
    Page120: form page for fetching

    On the page i need the pictures, i then get the page with the photos on it when required (ie: when the detail icon is clicked and i show my popup).
    Following piece of code is called within this function
    (only code ‘missing’ here is where i call another page process to fetch me contact details in a json format)

    //page 120 only holds the 2 images for a contact. Due to images being in
    //blobs and no easy way to dynamically fetch them, i made a small
    //form with the 2 photos on, and id + contact_id
    //(contact_id made PK for the ARF-process, since this is what is worked with)
    //The page is pulled in, and the photos retrieved
    
    //htmldb_get does not do the job! It only pulls the page from cache, which isnt what i want
    
    // arrays with the arguments and their values for the post
    var vArgs = new Array();
    var vVals = new Array();
    
    vArgs.push("P120_CONTACT_ID");
    vVals.push(cid);
    
    $.post('wwv_flow.show', 
           {"p_request"      : "NULL",
            "p_flow_id"      : $v('pFlowId'),
            "p_flow_step_id" : "120",
            "p_instance"     : $v('pInstance'),
            "p_arg_names"    : vArgs,
            "p_arg_values"   : vVals}, 
           function(data){
             var oContainerSmall = $("#id_photo_container").empty(),
                 oSmallPhoto = $(data).find("#P120_SMALL_PHOTO").attr({"id":"id_photo",
                                                                       "alt":oContact.lastname + " " + oContact.firstname}),
                 oLargePhoto = $(data).find("#P120_LARGE_PHOTO").attr("alt",oContact.lastname + " " + oContact.firstname);
    
             $("#large_photo_container").empty().append(oLargePhoto);
             $("#large_photo_container").css({"display": "block", "visibility": "hidden"});
    
             //Why remove and remake the container? 
             //for some reason i couldn't find out, the image width and height get reset to 0 after 
             // an initial display of the enlarged picture and closing its dialogbox.
             //I assume it is an apex+css+javascript issue.
             //The only fix i was able to find was to remove the div and remake a new one.
             // There have to be some properties set on the div and/or its children through
             // the closing of the popup dialog (for the larger picture), 
             // which then prevents subsequent calls to get the correct values.
             $("#large_photo_container").remove();
             var oContainerLarge = $("<div></div>").attr("id","large_photo_container").css({"display":"block", "visibility":"hidden"});
             oContainerLarge.append(oLargePhoto);
             $("body").append(oContainerLarge);
    
             //Hardcoded value here! Adapt when necessary
             if($("#id_contact_type").val() == "Conference Room"){
                var oLink = $("<a/>").attr("href", "#")
                                    .click(function(event){
                                             explode_headshot(event, this);
                                           });
                oContainerSmall.append(oLink.append(oSmallPhoto));
             } else {
                oContainerSmall.append(oSmallPhoto);
             };
    
             $("#contact_popup").dialog({modal: true,
                                         width: 750,
                                         resizable: false, 
                                         title: oContact.lastname + " " + oContact.firstname,
                                         close: function(event, ui){
                                           $("#id_photo").attr({"src": "", "alt": ""});
                                        }});
          });
    

    I wouldn’t call it ideal, but it works, and that’s all i need at this time 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Recently I have been investigating the possibilities of caching in ASP.NET. I rolled my
Recently, I've been dealing with an error with accessing MAPI via the .NET framework
Recently our site has been deluged with the resurgence of the Asprox botnet SQL
Recently I ran into this error in my web application: java.lang.OutOfMemoryError: PermGen space It's
Recently I started working with RAD and WebSphere on development of web services and
Recently I asked a question on stackoverflow about multiline tabs. Below is the link
Recently Jeff has posted regarding his trouble with database deadlocks related to reading. Multiversion
Recently, I started changing some of our applications to support MS SQL Server as
Recently I had to develop a SharePoint workflow, and I found the experience quite
Recently we got a new server at the office purely for testing purposes. It

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.