Height and width of image loaded into blob?

i am loading images into my database which is all working fine. in parts of my app i am displaying these images so i am wondering is there a way to get the dimensions (height an width) of the image you are loading in so that when it comes time to display you can scale as needed but the aspect ratio is the same so then the image is not distorted by just putting some random values for height and width.
<br><br>
eg
instead of
<br><br>
select decode(file_type,'I','<imge src="OWNER.download_file?p_file=' || nvl(file_id,0) ||'" height="100" width="100" />','') from project_file
where file_id = :P31_FILE_ID
<br><br>
i want to replace 100 with values from columns in table that were loaded at time of save
Message was edited by:
victorp

thanks scott. is it correct to say that this example is storing the image at whatever size the user puts in the width and height boxes on screen? thats what it looks like to me anyway. i see there are functions to get these but does the user have to enter them still? it will be just what i need if indeed I do need it!
Yes, that's correct. Of course you could modify the code so that you choose the size of the image, and not allow the user to change it.
Thanks,
- Scott -

Similar Messages

  • How to resize and maintain height and width ratio IR image column

    Hello, I am upgrading from 3.2 to 4.1 reports that include images in report columns. I have had good success with this except for one thing. If the height and width is fixed it distorts the photos, and if I do not have fixed dimensions the image may be too large depending on the original dimensions of the :P1_PHOTO item which is File Browse... BLOB column. I do not want to restrict users ability to upload large image files, or files with different dimensions, but I want them to display as a thumbnail size proportional to the original dimensions in the report, or maybe I need a different approach? Report region template is No Template. I appreciate any suggestions.
    select decode(nvl(dbms_lob.getlength(photo),0),0,null,'<img src="'||apex_util.get_blob_file_src('P1_PHOTO',id)||'" height="75" width="75"/>') photo from table.
    I tried using percent i.e.: width="10%" that does not work.
    I have tried several variations of <style> in page HTML header to change column width, but the image size does not change.
    <style>
    td[headers="PHOTO"] {
    width:75px;
    </style>
    <style>
    #apexir_PHOTO{width: 75px;}
    </style>
    Thanks.

    Try to go with max-width / max-height. However, if you have IE browser, hang on for pain. For some ideas, some links:
    http://wordpress.mfields.org/2011/scaling-images-in-ie8-with-css-max-width/ (ignore object-fit, it is not yet supported on most browser)
    http://stackoverflow.com/questions/3915219/max-width-on-img-tag-not-working-in-ie8
    etc. Be sure to try out your chosen solution on the target browser(s)!
    IE is just nasty :(
    What i have done before is not to have my browser scale my images, especially when the images can be large(r) and you expect quite some traffic. All those extra (kilo)bytes won't help it load faster. I just added an extra column in the table, like photo_thumb, and create a scaled version of the uploaded picture when it is being inserted.
    For example, i have the following process on my apex page, and i'm using wwv_flow_files.
    Have some code:
    IF :P3_FIND_PHOTO IS NOT NULL THEN
       DECLARE
         v_id number;
         v_small_photo blob;
         v_large_photo blob;
         v_mime_type apxt_contacts_img.mime_type%type;
         v_content_type apxt_contacts_img.content_type%type;
       BEGIN
          SELECT blob_content a, blob_content b, mime_type, content_type
          INTO v_small_photo, v_large_photo, v_mime_type, v_content_type
          FROM wwv_flow_files
          WHERE name = :P3_FIND_PHOTO;
          IF lower(v_mime_type) NOT IN ('image/jpg', 'image/jpeg') THEN
             raise_application_error(-20001, 'File for upload is not a jpg!');
          END IF;
          -- Rezise the photo so that it is proportionally 125*125
          -- ordimage is an oracle type able to manipulate all sorts of pictures
          ordimage.process(v_small_photo, 'maxScale=125 125');
          -- If contact is of type personnel, then no need to store
          -- a large photo since it wont be displayed
          IF :P3_CONTACT_TYPE_ID = 2 THEN
            v_large_photo := NULL;
          END IF;
          -- Delete previously uploaded picture
          IF :P3_ID IS NOT NULL THEN
             DELETE FROM apxt_contacts_img
              WHERE contact_id = :P3_ID;
          END IF;
          -- Insert the data into the contacts_img table as a
          -- SELECT from WWV_FLOW_FILES
          INSERT INTO apxt_contacts_img
          (contact_id,
           image_name,
           mime_type,
           content_type,
           filename,
           small_photo,
           large_photo)
          VALUES
          (:P3_ID,
           :P3_LASTNAME,
           v_mime_type,             
           v_content_type,
           :P3_FIND_PHOTO,
           v_small_photo,
           v_large_photo);
          -- Remove the image from the apex wwv_flows_files table
          DELETE FROM wwv_flow_files WHERE name = :P3_FIND_PHOTO;
       END;
    END IF;

  • Trying to determine the height and width of an image.

    Hi Everyone,
    I am currently trying to work out the height and width of a number of pictures. I have tried a couple of techniques. One involved using BufferedImages, which kept on throwing null pointer exceptions. So I am now tring to use the Image class from java.awt.Image. However I need to use an ImageObserver or some such thing, of which I have absolutely no knowledge. If there is anybody out there who knows how to gather the information I speak of from a number of photos, and is feeling kind enough to impart their knowledge to me it will be greatly appreciated. Thanks.
    Regards
    David

    Well, maybe your problem is loading in the images, but I'm assuming you know what your question is since I don't feel like going into what ImageObserver does (That's what google is for).
    Anyways, to get the height and width of an image you do this:
    You initialize your image:
    Image image = getImage("file.jpg")  //I don't remember the if this is correct, it's just my memory.To get the dimensions"
    image.getWidth();
    image.getHeight();If these return 0 it's more than likely because the image hasn't loaded correctly, which is why you need ImageObserver (IIRC there is a better API in the new ImageIO library, check the API).
    Best of luck.
    Virum

  • How do I view the height and width of an image as I adjust the crop handles

    How do I view the height and width in pixels of an image as I adjust the crop handles before I actually crop the image?

    If you are in Photoshop CC, go into Preferences, click Interface, and turn on Show Transformation Values. In the picture below, setting it to Top Right means the pixel height and width appear to the Top Right of the Crop tool pointer.
    (Edit: The picture only shows Height because the bottom edge is being dragged. If a corner was being dragged it would say H and V.)

  • Height and Width of an image

    Hello All,
    I wanted to fnd out the width and the height of an image (.jpg).
    Please could anybody let me know if there are any function modules or any other ways to find it out.
    Thanks and Regards,
    Sushmitha

    Hi Vikrant,
    I am using fileupload UI element.
    I wanted to determine the height and width of the image internally in webdynpro application, after which I can allow them to save.
    Thanks and Regards,
    Sushmitha
    Edited by: Sushmitha S on Jun 19, 2009 1:49 PM

  • Height and width question in an applet

    I have loaded a picture into an applet. Is it possible to get the pictures height and width?

    I assume you loaded it into an image. In this case, you can call Image.getHeight() and Image.getWidth(). If you get -1 returned, search for a useful thread on ImageObserver.

  • Increase swf file height and width...

    Hello guys
       I am trying to increase a swf file height and width so it can fit better in my screen. I don't want to rework on everything again in my fla file because it's big hassle. (changing background size makes every symbol off). Are there anyway to do it? Thanks a lot!

    you could load your swf into an empty movieclip/loader in another swf.  when loading is complete you can resize your target movieclip/loader.

  • Dynamically read height and width dimensions of .mov

    Hi there!
    I am wondering if anyone knows of a way to dynamically get the height and width dimensions of a quicktime movie, before streaming it?
    The circumstances are this. I have clients who upload quicktime movies to my server. Right now, I use code to embed movies in a fixed size page, but the movies can vary quite dramatically in terms of their dimensions. For example, if the movie is 400px wide, it looks fine in my page. However, if it is 800px wide, it extends out beyond the borders of my page and looks terrible. I could just make a huuge page, but then the tiny movies look ridiculous
    If I could somehow gets the dimensions of a movie before it starts streaming, i could create a large target page for larger movies, and a small target page for small movies. Basically it comes down to being able to somehow dynamically read the dimenions of the movie.
    Is this even possible? Like my boss keeps telling me, it's all just Math isn't it?
    Thanks!!!

    Hmmm...
    I think the movie dimensions are exposed to JavaScript, but only after the movie has opened. So you would have to load the movie into the plugin, then get the dimensions, then use JavaScript to rewrite the page. Which I don't think is quite what you had in mind; you're wanting to collect this information and deal with it before you write the page.
    Let me see if I have this straight...You are allowing clients to upload movies to your server, and then you're hoping to generate an embedded movie page on the fly in PHP to display the movie just uploaded, correct?
    For a library of movies, you could generate a small database of all the movie dimensions, then just look that data up in the table when you generate the page. The trouble is, I don't know of any way to get the movie dimensions except to get them from QuickTime, and to do that you have to load the movie into either the player or the plugin. You could, for instance, have an AppleScript that looks at each movie and populates the database, but I don't see how you could trigger that to run on upload, and I don't know what kind of server you're using.
    Now here's an idea...If you have some way of arbitrarily reading and parsing the QuickTime file, you can get the dimensions out of the file, but it isn't easy. If you are lucky, the moov atom will include a prfl atom (movie profile) which includes the video dimensions. But the prfl atom is not mandatory, which means you have to look at each trak atom that contains video and examine the size *and position* and accommodate the fact that you may have multiple, overlapping video tracks. But you could get the data by parsing the QT atoms yourself. All the data you need to do that is here:
    http://developer.apple.com/documentation/QuickTime/QTFF/QTFFPreface/chapter1_section1.html
    ...and may God have mercy on your soul!
    Seriously, though, you CAN parse a QT file, and that might be the best (though obviously not the easiest!) way to get the data you want dynamically. QuickTime does help you out by giving you all the offsets for all the atoms, but it can be tricky!
    --Dave Althoff, Jr.

  • Can PDF's be resized? (height and width)

    I have a large PDF booklet that I would like the height and width reduced.  Is this possible?

    If Dov see's this, I'll get reprimanded, but...I do not see him here often.
    Downscaling will not have the caveat of upscaling, where there would be an effective loss of image/pixel resolution.
    Obviously for a one time print, you could use the page scaling from the print dialog. If you need a more permanent solution, you could set up a custom page size and print to pdf, effectively re-frying the pdf. The result would include a loss of color management, multimedia content, bookmarks(?), live transparency and other behind the scenes elements within a pdf. To much extent, it would appear and behave as a typical pdf, but advanced features are stripped out when handling a document this way. (Sometimes, for the better, IMO)
    Optionally, preferably, and untested, I would place the pdf into InDesign, scale accordingly and Export to pdf. Given the proper export settings, I believe more original structure would be maintained.

  • Report Designer - Layout height and width

    Hi Experts,
    Is there an option to adjust the report designer layout height and width? I am able to adjust the individual row and column height. I have a report designed in report designer which will have only 5 rows. when I execute this web template the report item is displayed in one entire page instead of only 5 rows.
    How can I control/adjust the page size in report designer? Is this possible?
    Thanks,
    Gnana

    Gnana,
    are you starting the report from the portal directly, or do you have it embedded into a web template?  As the Report is a web item, you can set the size of the item.
    At first I was considering posting the reports directly to the portal, but there are some things that I don't like with how it handles them - for example if you have a report based on the query view, when you post it directly to the portal it will execute it with the saved variable values before you can change them.  Thus, I have to put it into a web template and set to prompt for variables at the beginning.
    Thanks

  • As being a novice with my Mac Pro computer and Cannon 5D mark 3 camera my issue has arisen while over the last year and half, when down loading into my Photoshop Lightroom 4, my 18,000  photograph were not catalogued correctly, or hardly at all, so now ov

    As being a novice with my Mac Pro computer and Cannon 5D mark 3 camera my issue has arisen while over the last year and half, when down loading into my Photoshop Lightroom 4, my 18,000  photograph were not catalogued correctly, or hardly at all, so now over several months time my photos have apparently been redirected in my libraries and have begun not appearing in their allotted frames next to their number in the library they are in. they also have a small question mark (?) next to the photo space. The frames are blank but indicates that there is a photo there. The majority of photos are blank but about a tenth are seen . i apparently need to retrace where they went but do not know how to get that done . can someone help please?

    It would be difficult to tell you where to begin. If you moved photos around to different folders and didn't use Lightroom to move them, that would cause Lightroom to lose track of where they are. You have to remember that your images are not "in" Lightroom. Lightroom simply points to them wherever they are on your computer. All of the location information as well as the changes that you make to your images is stored in the catalog, which is a database. This catalog is central to the operation of Lightroom, and it's essential that you understand how it works and how to make it work for you. For all of those images that have "?" On them, or the folders that have the same, you will have to go through the process of locating them and showing Lightroom where they are located. With 18,000 images, and many of them missing, it might just be easier to start a new catalog and organize things properly from the beginning in that catalog.

  • Animated Height and Width

    I'm trying to write lingo, that tells a certian object, upon
    the mouse leaving, to scale down by x amount. However I want it to
    be animated and happen over time. But I want it to all be in Lingo,
    within the cast member. I have it looking like this right now, but
    this just makes it go from one size, immediately to a smaller size.
    Like I said, I would like this to happen over a period of say, .5
    seconds.
    on mouseLeave me
    sprite(2).height = 438
    sprite(2).width = 292
    end
    I'm doing this for something like a portfolio. You can roll
    over images and they get larger, but when you roll off of them,
    they get smaller. I just want them to get smaller over time, and
    not immediately. Any help would be great. Thanks.
    ~Quadpolar

    Since mouseLeave only happens once it can't easily be used to
    animate
    something... so, you need to set up a system where the
    shrinking happens
    on an event that happens more often (like enterFrame)
    property pShrink
    on beginSprite me
    pShrink=0 --set it to not shrink when it starts up
    end
    on mouseLeave me
    pShrink=1 --start shrinking now
    end
    on enterFrame me
    if pShrink=1 then
    if sprite(2).height>400 then
    sprite(2).height=sprite(2).height-2
    sprite(2).width=sprite(2).width-2
    else
    pShrink=0 --now it will stop shrinking
    end if
    end if
    end
    This script kind of assumes that the sprite is square, since
    it adjusts
    the height and width evenly. Change those lines where the
    width and
    height are lowered by 2 to a greater number to make it go
    faster or a
    lower number to make it go slower (it has to be an integer,
    so 1 is as
    slow as it gets). Also, if the height and width are not
    equal, then
    adjust those same numbers accordingly. I also chose the
    number 400
    fairly arbitrarily.. that should be whatever height the
    sprite should be
    when you want it to stop shrinking.

  • Fancybox iframe in Edge Animate - Not showing correct height and width

    Hi All,
    Can someone please provide advice or a solution to this issue.
    I have been trying to use the Fancybox.js in Edge Animate to call an iframe (as a lightbox pop up).
    However when I try this it doesn't show the correct height and width properties - even though I am setting them.
    When I test this on my hard drive it works fine in Chrome and Firefox. However when tried online on a test server I get a slim pop up that hasn't set the height properly.
    Could this be because the iframe is pre-loading the composition/html page first before setting the size??
    Please help
    CODE USED:
    $.fancybox.open(
    type: 'iframe',
    autoScale : 'false',
    height: '600',
    widht: '600',
    href : 'website composition link.html',
    padding : 0
    Other references: http://businessanywhere.biz/blog/2013/03/adding-a-lightbox-to-edge-animate/
    Cheers,
    Jason

    HI Darmendra,
    Thank you for your reply to this.
    I worked out what the problem was - my external composition that was created Edge Animate was centred both horizontally and vertically.
    This was created the problem. When I took this off the fancy box worked well.
    Cheers,
    Jason

  • Measuring a letter (actual height and width)

    Hello,
    I would like to know if there is a way to measure the height and width of a letter (green line) without creating outlines, that is, maintaining it as text and not turning it into a path. I'm not interested on the height usually displayed (blue line). I'm aware that I could make a copy, measure and delete it later. But for my specific case this does not help.
    Warm Regards,

    I don't have a Twitter account. I've aways assumed that whatever they are, they must be intended for twits. ;-)
    Nor a Facebook account 'cause if I wanted my mugshot somewhere, I'd commit a crime. Nor do I post videos on YouTube. If I wanted to do that, I'd put them on MeTube.
    I guess I'm just not a "social media" kind of guy. But there's a vintage motocross race in Elko today; if you must, you can probably find me there this afternoon.
    I'm aware that I could make a copy, measure and delete it later. But for my specific case this does not help. 
    The script Jacob refers to was written to enable one to change existing type to a particular capheight (based on the capital M of the font used), not to tell you the height of a given character. Plus, it does work by converting text to paths. That's the only way you're going to get a measure of the glyphs. And it dosen't measure width.
    Type has no absolute measure. There is no "height of an E" until you set it to some height. So I can't tell what you are trying to achieve if it disallows setting the type (or a copy of it), converting it to paths, and then getting its measures--which you could automate with a macro (Action), without having to resort to scripting.
    You're not likelly to get help from an AI Javascripter if you're not willing to explain exactly what you are trying to do. Script writing is too tedious and time-consuming to do as a favor just based on a guess at what the actual desired functionality is.
    JET

  • How to keep anchor in middle while changing height and width for comp in extendscript?

    When i try to change my composition height and width using extendScript, it works but with anchor point at top left corner. How do I maintain it at the center??
    My code:
    comp.width = 4000;
    comp.height= 4000;
    result:
    expected:
    Thank you

    So you caught me on an open day, and I even dragged in another staffer (Josh) to sit and figure this out and we did. I just need to clean it up into a function for ease of use. It literally became an obsession between Josh and I to figure this problem out. We seriously need to get outside more, haha. I'll post the solution here shortly once it's cleaned.
    Is there a way to access layer's properties like position, rotation etc without its comp open or selected and not knowing its item number.
    Finding layers can be done by looping through all comps and all layers. You must set a series of matching criteria to compare against so you don't accidentally grab a duplicate layer that has the same values though. Usually the layer name, size or any property spec that is unique, source asset if it's an AVLayer, etc... It's also possible to have a list returned that you choose from if you wanna verify the layer before proceeding. All this has to be manually coded though.
    var comp = app.project.activeItem;
    var layer = comp.selectedLayers[0];
    //assuming layer is a comp
    layer.duplicate();
    var num = layer.index;
    var name = (layer.name + "_comp");
    var newComp=  comp .layers.precompose([Lnum], Lname, true);
    newComp.width =  4000;
    newComp.height =  4000;
    now what am trying to achieve is move the comp (layer) to the center of newComp i.e at 2000, 2000
    I'm not fully understanding the process you are intending. You are searching for precomps (comps used as layers) basically?

Maybe you are looking for