Pull image from library with AS3?

Hello, I'm a fairly experienced AS2 programmer transitioning
in progress to AS3 programmer. I'm using Flash CS4 as my IDE with
Actionscript 3 and Flash Player 10. I'm working on a bigger project
but the area I'm struggling in is dynamically pulling an image from
the flash library (already loaded). I've been finding the same
answers to my question all over and they seem to keep producing the
same error so apparently I'm just not getting some little detail. I
have an image loaded in the library called test1.jpg. I've right
clicked on it and selected 'Export for ActionScript' and 'Export in
frame 1'. The class is 'MyMc' and the Base class is
'flash.display.BitmapData'. My code is attached.
and it produces the following errors:
quote:
1136: Incorrect number of arguments. Expected 2.
1067: Implicit coercion of a value of type MyMc to an
unrelated type flash.display:DisplayObject.
What is the deal. I've posted on other forums and get the
same reply. I'm really struggling with why CS4 is acting this way.
AS3 is proving very difficult to transition to.

Alaskan57,
> The MyMc name actually came from a tutorial I was
> trying to follow... they were using movieclips but I
> wanted to adapt their tutorial to Images
Makes sense. :) And again, the name *as a name* (as a
string) doesn't
really matter, but it's always important to consider what
sort of object
you're dealing with, whether by inheritance or not, because
they all have
their own unique characteristics ( ... otherwise they
wouldn't be different
types of object!).
> Yea, I remember learning AS2 and how difficult it was...
> but AS3 I think has that beat as I'm not very familiar
> with OOP programming in general. But I'll get there :)
You will; it just takes time. Everything I know is something
I scraped
from online tutorials, read from books, or asked of friends
on IM.
Eventually, the principles of OOP finally gelled in my head.
To me, OOP is
more about organization than anything else. It's not
something magical or
mystical (which took me a while to believe!) ... it's just a
way of
arranging code into reusable nuggets called objects. Each
object is defined
by its class, and generally speaking, classes organize their
functionality
into properties, methods, and events. Those three basic
categories refer
respectively to characteristics the object has, things the
object can do,
and things the object can react to.
> Thanks for your explanations... I learned a lot!
Glad to hear that. :)
> BTW, you said I did not need to import the
flash.display.*
> class.
That's only true when you're dealing with timeline code. In
custom
classes, especially in AS3, you have to import just about
everything. But
if you're in a keyframe of the timeline, you only have to
import classes
outside of the flash package (such as, for example, the fl
package, which
tends to hold components; the air package, which holds AIR
APIs, etc.).
> Is there some online information that would go into more
detail
> about why I should import a class or why I wouldn't need
to?
imports are required when Flash needs to know how to define
the objects
you're referring to. If you're using 3rd party classes, like
TweenLite,
then you would need to import those packages/classes ...
because Flash has
no idea what a TweenLite object is without that information.
In custom
class files, you have to import everything that isn't a part
of the core
functionality (that is, anything that isn't a part of the Top
Level items
listed here ...
http://help.adobe.com/en_US/AS3LCR/Flash_10.0/index.html
> I've been wanting to try out TweenLite as well as other
classes but
> can seem to figure out this whole import when I need to
thing.
It certainly doesn't hurt anything to import packages; it
only "hurts"
when you fail to import a package that needs it, so to play
it safe you
could import everything. Just bear in mind that anything that
truly needs
importing must be imported for every frame in which you refer
to that
package's class(es). If a keyframe in your timeline
instantiates a
TweenLite object in frame 10, you'll have to do the import
there. You
should be able to *use* that instance in any frames after
that, even without
another import. If you then decide to instantiate *another*
instance in,
say, frame 100, you'd have to re-import the TweenLite class
in frame 100.
> PS, I have your book (but it's at home at the moment :))
Thanks for the purchase!
David Stiller
Contributor, How to Cheat in Adobe Flash CS3
http://tinyurl.com/2cp6na
"Luck is the residue of good design."

Similar Messages

  • Screensaver pulling images from who knows where...

    All,
    I'm a bit confused here. My screen saver used to be an album in my iPhoto. However, seemingly out of nowhere, it was pulling images from who knows where and all over the place.
    I have deleted my iPhoto library and re-imported my images and re-made my albums. But, have not fixed the problem. I have also verified and repaired permissions and rebooted also not fixing the problem.
    Any help would be greatly appreciated.

    Try com.apple.screensaver.[long alphanumeric number].plist, if you can find it on your machine. I just changed my Screensaver preferred folder and then did a File Buddy search for .plist files that had been modified in the last 5 minutes, and that one turned up — among a few others. I doubt that the number in your plist's filename would or should be the same as mine, and that's why I didn't include mine above. The path to my file is:
    HD>Users>My username>Library>Preferences>ByHost>file

  • Is there a way to pull images from an slideshow?

    how do i pull images from a slideshow and bring them back to normal iphoto album?

    Those images are in your Library.
    Regards
    TD

  • How can I download images from website with Automator?

    Hi!
    I want to ask how can I download images from website with Automator like here http://www.youtube.com/watch?v=hQm7Xr9jY0w&t=85m15s (in 1:25:15).
    I want to download these images to my downloads folder. Some things have changed and I can't find exact options as then. When I am trying to make it it shows "The action "Download URLs" was not supplied with the required data."
    I am using 2012 late iMac with Mac OSX 9.2 (Mavericks).

    There are two apps that I know of - and I would also swear that they come from the same developer, although they've different names. Both have free trials and both cost $40 (but both do 'other' video conversion as well).
    One is WonderShare - I bought this one and it works very well for downloading YouTube videos as well as converting just about any file format you can think of.
    The other is iSkysoft Video Converter (just noticed that it's now $36).
    I tried them both and finally decided on WonderShare. Give them both a trial run and decide if you like either one enough to buy it. I don't know of any 'free' software that will allow you to download and convert YouTube videos, but perhaps someone else will come along and know of something...
    Good luck,
    Clinton

  • Moving images from library to library WITH Faces information

    Ok.
    iPhoto 09/faces
    Can someone out there tell me, first off, is it even possible to move photos from one library to another library WITH all the Faces effort I've put in on those photos (say from my default library on my hard drive to another person's library on an external hard drive)?
    That way they don't have to be rescanned and then I have to go through and correct the crappy scanning effort that the program did all over again.
    I tried exporting/importing, straight copy, etc. with no dice.
    I don't want to keep having to re-correct all the faces in images I transfer between libraries.
    "Help me Obi-Wan Kenobi....You're my only hope!"

    For folks out there here is the results of Terrence's suggestion (which was a good one BTW, I don't want to dump on him - it was good thinking on his part! Thanks Terrence).
    iPhoto Lib Manager still ***** (on my system anyway - iMac OSX 10.5.6).
    I installed the thing and tried moving 1000 photos with faces info organized nicely - no dice - it crapped out.
    First make sure all the permissions are set properly and the library mounts automatically (under the options). Then it will at least ATTEMPT to copy everything (also edit prefs to reflect all the metadata that goes with the photos like faces info, dates, desc. etc).
    But while thing appear to go well, it craps out at the end leaving you stymied. It re-scans the imported images and the faces data does not come through in the end despite it's trying to do so.
    I tried it with 80 photos, just to make sure I wasn't trying to fit 20lbs of manure into a 10lb bag. Same story with the smaller transfer
    If I go any smaller, I may as well have used the public version (free) which limits you to 20 at a time.
    So bottom line - according to my experience - if you and someone else have the same photos in your separate libraries and want to share the effort one of you puts into organizing faces info - you're hooped/screwed/pooched!
    Nada - diddly - bupkiss!
    VERY DISAPPOINTING! Both the iPhoto 09 AND the failed (but valiant) attempt by iPhoto Lib Man.
    Should've stuck with iLife 08 and lived with it...sigh.

  • Nikon D800 raw files taken with Sandisk extreme plus 32GB SDHC card got corrupted. Able to preview them in Lightroom4.4 Library, but not able to import or transfer the files from card to computer. Any ideas on how to save images from Library Window in Lig

    Hi, I have shot few pictures on 31st December night in RAW mode using Nikon D800 and Sandisk extreme plus 32GB SDHC card. It looks like card got some memory errors so not able to transfer the files from Card to computer. However I am able to view the pics thru Lightroom ver 4.4 Library, but when I tried to import them, it gives me an error stating that file can't be read.
    Is there a way to save the pics from Library window in lightroom overcoming the card read errors ?
    Thanks in advance

    Hi SSPRENGEL,
    Thank you for your response. Here is the error message I am receiving, I tried with various destination folders in the computer but it still gives the same error:. Just to let you know, I am able to import pictures into these folders from other memory cards.
    I am able to finally at least extract the jpgs using the option suggested by elie-d

  • Emptying Aperture trash doesn't remove images from library

    Not sure what's going on.
    Did a little house cleaning over the past few days and deleted about 2K images overall. And I emptied the aperture trash. The number of files in the program goes down. But the size of the library doesn't change. The date of for the library does change and shows the current time.
    I archived all my images to an external vault. That vault is significantly smaller than my library.
    Then I upgrade to the new version 3.1.2. Deleted preferences.
    I created a new library as a test. I imported 188 images. Then deleted a few. Emptied the aperture trash. The number of images went to 152.
    The size of my library remained unchanged. No aperture images in main computer trash can. And when I go into the masters folder in the library I see all 188 images there.
    System: mac pro 2006. OS 10.6.8

    Thanks for taking the time to reply.
    I don't remember which version I upgraded from. But the problem was there in the old version as well as the new one.
    I did do the repair rebuild just before upgrading with only a 0.1GB difference in file size afterwards.
    And, as I said, when creating a brand new library with only 188 images the same problem occurred. So 2 separate libraries on the same drive.
    I just created a new library as a test on my main drive (a different drive) with the same issue. Files are deleted in the program but not in the library.
    There is no problem with the trash in any other respects. Other files have been deleting just fine.
    The aperture deleted images aren't even reaching the trash can.
    I might need to reload aperture.

  • Reference external library movieclip in library with AS3

    Hello, i am able to load at runtime a library asset in flash
    cs3. i do this by setting up its linkage property and setting its
    base class. for eg
    Class: MyButton
    Base: flash.display.MovieClip
    then in my document class, say i had
    com.kofi.InitializeTemplate, my class looks like this
    package com.kofi
    import flash.display.MovieClip;
    import MyButton;
    public class InitializeTemplate extends MovieClip
    var testButton:MyButton;
    public function InitializeTemplate():void
    trace("the button class has been called");
    testButton = new MyButton();
    addChild(testButton);
    however, once i bring in an external library asset(which i
    have already exported and set it base class etc), i am unable to
    call this shared library asset with as3. anyone know what i am
    talking about?

    Hi Sigiswald,
    well it seems SAP also considers that a bug, if you go to the Service marketplace -> Support Packages and Patches -> SAP NetWeaver -> SAP NETWEAVER -> SAP NETWEAVER 2004S -> Entry by Component -> Development Infrastructure, there is a SAP_BUILDT SP09 Patch 1 referring to note 993799 which says:
    "Jar files, especially from development components with type "External Library" are not assembled into the WDA archive for Web Dynpro development components."
    Are you using the original SP09 version or this patch?
    Regards,
    Marc

  • Can i display all images from databases with adf jsp

    hi
    I want to display all images from the databases whit adf bussines components, because with the sample on http://www.oracle.com/technology/training/products/intermedia/index.html page, i only can display 10 images. i'd lije to know if i can to search in the databases by the id of the image.
    this is the code:
    %@ taglib uri="http://xmlns.oracle.com/adf/ui/jsp/adftags" prefix="adf"%>
    <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
    <%@ page contentType="text/html;charset=windows-1252"%>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>untitled</title>
    </head>
    <body>
    <html:errors/>
    <table border="1" width="100%">
    <tr>
    <th> </th>
    <th>
    <c:out value="${bindings.ImagenView1.labels['Id']}"/>
    </th>
    <th>
    <c:out value="${bindings.ImagenView1.labels['Descripcion']}"/>
    </th>
    <th>
    <c:out value="${bindings.ImagenView1.labels['Image']}"/>
    </th>
    </tr>
    <c:forEach var="Row" items="${bindings.ImagenView1.rangeSet}">
    <tr>
    <td>
    <c:out value="${Row.currencyString}"/>
    </td>
    <td>
    <c:out value="${Row['Id']}"/> 
    </td>
    <td>
    <adf:render model="Row.Image"/>
    </td>
    <td>
    <c:out value="${Row['Image']}"/> 
    </td>
    </tr>
    </c:forEach>
    </table>
    </body>
    </html>

    I think you want the interMedia JSP tag library...
    http://www.oracle.com/technology/software/products/intermedia/htdocs/descriptions/tag_library.html
    Larry

  • Flash CS4 crashes when dragging image from library to stage

    Everytime I'm trying to drag an image from the library to the stage, the program crashes.
    I've been sending the crash logs to Adobe many times, but never got any solution from them.
    In the log there a line that says:
    <crash exception="EXCEPTION_ACCESS_VIOLATION" instruction="0x0c4feb66>
    I'm working with 10.0.2, I thought the latest update will fix that, but it doesn't.
    Changing the UI from Essential to Classic doesn't help (read somewhere it can help).
    Anyone knows what to do to stop these crashes?

    Yes, did all the updates, both XP and Java.
    It looks like it's a library issue. Almost every action I'm doing in the library (drag, copy etc.) causes the Flash to crash.
    What can be the problem?

  • Why can't I right-click to save images from webpages with FF 3.6.13?

    Ever since I updated my FF version to 3.6.13, I find I have trouble saving images from websites. And not just on specific websites, but everywhere (and they aren't protected or anything from saving). In the past I could right-click on them and do "save as..." Now the only option I have is "save link as..." Whenever I click on this, nothing at all happens. Is this a bug with version 3.6.13? It's really annoying.

    Start Firefox in [[Safe Mode]] to check if one of the add-ons is causing the problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).
    * Don't make any changes on the Safe mode start window.
    See:
    * [[Troubleshooting extensions and themes]]
    * [[Troubleshooting plugins]]
    There are other things that need attention:
    Your above posted system details show multiple Java Console extensions.<br />
    You can uninstall (remove) the Java Console extensions and disable the Java Quick Starter extension, you do not need them to run Java applets.
    See http://kb.mozillazine.org/Java#Multiple_Java_Console_extensions
    Disable the Java Quick Starter extension: Tools -> Add-ons -> Extensions<br />
    Control Panel -> Java -> Advanced tab -> Miscellaneous -> Java Quick Starter (disable)
    See http://www.java.com/en/download/help/quickstarter.xml - What is Java Quick Starter (JQS)? What is the benefit of running JQS? - 6.0

  • Retrieving Images from Mysql with PHP

    Hi I have been trying to work this out with no success so some help would be really appreciated.
    I have two tables  in Mysql,
    IMAGES  AND EXHIBITORS
    IMAGES
    `image_id` INT(5) UNSIGNED NOT NULL AUTO_INCREMENT ,
      `filename` VARCHAR(255) CHARACTER SET 'latin1' COLLATE 'latin1_bin' NOT NULL ,
      `mime_type` VARCHAR(255) CHARACTER SET 'latin1' COLLATE 'latin1_bin' NOT NULL ,
      `file_size` INT(11) NOT NULL ,
      `file_data` LONGBLOB NOT NULL ,
      `user_id` VARCHAR(50) CHARACTER SET 'latin1' COLLATE 'latin1_bin' NOT NULL ,
      `accom_id` INT(5) NOT NULL ,
      `exhibitors_exhib_id1` INT(5) NOT NULL ,
    PRIMARY KEY (`image_id`, `exhibitors_exhib_id1`) ,
    INDEX `user_id` (`user_id` ASC) ,
    INDEX `accom_id` (`accom_id` ASC) ,
    INDEX `fk_images_exhibitors2` (`exhibitors_exhib_id1` ASC) ,
    CONSTRAINT `fk_images_exhibitors2`
    FOREIGN KEY (`exhibitors_exhib_id1` )
    REFERENCES `christmas_shopping`.`exhibitors` (`exhib_id` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
    ENGINE = InnoDB
    AUTO_INCREMENT = 7
    DEFAULT CHARACTER SET = latin1
    COLLATE = latin1_bin
    EXHIBITORS
    `exhib_id` INT(5) NOT NULL AUTO_INCREMENT ,
      `exhib_name` VARCHAR(50) CHARACTER SET 'latin1' COLLATE 'latin1_bin' NOT NULL ,
      `exhib_years` SET('2010', '2009') NULL ,
      PRIMARY KEY (`exhib_id`) )
    ENGINE = InnoDB
    AUTO_INCREMENT = 3
    DEFAULT CHARACTER SET = latin1
    COLLATE = latin1_bin
    PACK_KEYS = DEFAULT
    I think I am happy with the Mysql,  and I have read the various arguments about storing images in mysql but for my purpose I wanted to store the image in the database.
    I have already created the upload and the images have uploaded correctly and I can see the data in the database, however I just have been able to retrieve the images back into a webpage.
    I have a .php file which is merging these to tables correctly but the image is displayed as
    o¿9®&#143;áŸÇ½G_ŒÁ%×Úoíø&#157;$M©7ûiè Óµ|Mn.˨â=Ž&#127;2Z ¥<º½Hs/¸úfŠÇðïˆ-üE`· &#157;¯üq÷C[ öTªÂ´ Jnéžl¢âÜdµ (¢µ$(¢Š�(¢Š�(¢Š�(¢Š�(¢Š�(¢Š�CÅ Š:šZ�(¢Š�(¢Š�) -!  ¢Š(�¢Š(�¢Š(�¢Š(�¢Š(�¢Š(�¢Š(�¢Š(�¢Š(�¢Š(�¯ ý¤Z_ x^óÃ&#144;K2ZJ»¦ò>ô»NJ ûç¥{6½©.‘£ÝÞ &#144;ÆZ¼*-Sûz"$pÌ]&#157;$þ%5ù¿ æ•0˜xa©;9êý O›=¼³ ªÍÔžÈøžþ t·[c*¦À  T?wøQ·/?ίøWÅ×z]Ü  r츌þæLôoâVþð¯jøÍð¶O Y½Îœ¨Œ›–k4OšWþê·mß1÷/ Abž<[Þ¢þþÕŠþ÷ûÛ&#127;&#157;}nCžÏ*š¡]Þ“ü?¯ëÏ‹ …X¨óÇIþgÔÔVf‹¬Ûë¶)snÙVê½Á:ý¶ &#141;H©ÁÝ=&#143;–iÅÙî QEh   ¢Š(�¢Š(�¢Š(�¢Š(�¤4´‚€ Š(  Š(  Š(  Š(   qKHh Ð ÑE �QE �QE �QE �V^½ª¦‡¥^²ï .í¾µ©^kñÿ�Z  Ã]NmÛY“
    The code I have in the page is as follows. After many hours of trying to work it out I just cant see what I am missing and would really appreciate some help. I have highlighted where the echo is that relates to my image.
    <?php require_once('../Connections/christmas.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    $maxRows_Recordset1 = 10;
    $pageNum_Recordset1 = 0;
    if (isset($_GET['pageNum_Recordset1'])) {
      $pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
    $startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
    mysql_select_db($database_christmas, $christmas);
    $query_Recordset1 = "SELECT exhibitors.exhib_name, images.file_size, images.file_data FROM images, exhibitors WHERE images.exhib_id = exhibitors.exhib_id";
    $query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
    $Recordset1 = mysql_query($query_limit_Recordset1, $christmas) or die(mysql_error());
    $row_Recordset1 = mysql_fetch_assoc($Recordset1);
    if (isset($_GET['totalRows_Recordset1'])) {
      $totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
    } else {
      $all_Recordset1 = mysql_query($query_Recordset1);
      $totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
    $totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <?php $pagetitle="The Christmas Shopping Fayre"?>
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <meta http-equiv="Content-Type" content="; charset=" />
    <link href="../public/CSSFiles/oneColElsCtrHdr.css" rel="stylesheet" type="text/css" />
    <link href="../public/CSSFiles/whitebackground.css" rel="stylesheet" type="text/css"/>
    <link href="../public/CSSFiles/shoppingonline.css" rel="stylesheet" type="text/css"/>
    <link rel="icon" type="image/x-icon" href="http://www.gravatar.com/avatar/c4dac336c5be729fc542c12bfbb50099.png" />
    <!--[if IE]>
    <style type="text/css">
    a { zoom: 1;}
    </style>
    <![endif]-->
    <script type="text/javascript">
    <!--
    function MM_showHideLayers() { //v9.0
      var i,p,v,obj,args=MM_showHideLayers.arguments;
      for (i=0; i<(args.length-2); i+=3)
      with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
        if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
        obj.visibility=v; }
    //-->
    </script>
    </head>
    <body id="shoppingonline" class="oneColElsCtrHdr">
    <p> </p>
    <?php include("includes/header.php"); ?>
    <br />
    <br />
    <div id="bannersp"> </div>
    <h1>Welcome to <?php echo $pagetitle?></h1>
    <p>
    </p>
    <form method="post" name="form1" id="form1">
    <p> </p>
    <table border="1" cellpadding="5" cellspacing="5">
      <tr>
        <td>exhib_name</td>
        <td>file_size</td>
        <td>file_data</td>
      </tr>
      <?php do { ?>
        <tr>
          <td><?php echo $row_Recordset1['exhib_name']; ?></td>
          <td><?php echo $row_Recordset1['file_size']; ?></td>
          <td><?php echo $row_Recordset1['file_data']; ?></td>
        </tr>
        <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
    </table>
    <?php include("includes/footer.php"); ?>
    </body>
    </html>
    <?php
    mysql_free_result($Recordset1);
    ?>

    Hi Murray
    You must despair with beginers like me,  attachments showed as having been
    sent so lets try again.
    I have been able to find a tutorial  that works well all the way through, I
    can even see the images in the browser!!  but only shows images individually
    on a page.
    http://www.phpriot.com/articles/storing-images-in-mysql/7
    However, what I want to do is to have a page that links my images table and
    another table,  all of which I have set up and is working other then showing
    the images.  All was very straight forward until sorting out the image.  If
    I can work out what to take from the above tutorial that works into my page,
    I am sure all will be fab.
    Storing them in the mysql was my preferred method as there are not alot and
    they can be low resolution and I thought it would be fairly straight
    forward!!  however finding out that I am having to adapt code as dreamweaver
    doesn't support the blob attribute is getting me out of my knowledge.
    All the best
    Gilly
    Attachments inserted
    show_image.php
    <?php require_once('../Connections/getImage.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    $colname_Recordset1 = "-1";
    if (isset($_GET['image_id'])) {
      $colname_Recordset1 = $_GET['image_id'];
    mysql_select_db($database_getImage, $getImage);
    $query_Recordset1 = sprintf("SELECT image_id, mime_type, file_data FROM images WHERE image_id = %s", GetSQLValueString($colname_Recordset1, "int"));
    $Recordset1 = mysql_query($query_Recordset1, $getImage) or die(mysql_error());
    $row_Recordset1 = mysql_fetch_assoc($Recordset1);
    $totalRows_Recordset1 = mysql_num_rows($Recordset1);
    header('Content-type: ' . $row_getImage['mime_type']);
    echo $row_getImage['file_data'];
    mysql_free_result($Recordset1);
    ?>
    view.php
    <?php require_once('../Connections/getImage.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    $maxRows_Recordset1 = 10;
    $pageNum_Recordset1 = 0;
    if (isset($_GET['pageNum_Recordset1'])) {
      $pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
    $startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
    mysql_select_db($database_getImage, $getImage);
    $query_Recordset1 = "SELECT * FROM images";
    $query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
    $Recordset1 = mysql_query($query_limit_Recordset1, $getImage) or die(mysql_error());
    $row_Recordset1 = mysql_fetch_assoc($Recordset1);
    if (isset($_GET['totalRows_Recordset1'])) {
      $totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
    } else {
      $all_Recordset1 = mysql_query($query_Recordset1);
      $totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
    $totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head>
    <body>
    <table border="1" cellpadding="5" cellspacing="5">
      <tr>
        <td>image_id</td>
        <td>filename</td>
        <td>mime_type</td>
        <td>file_size</td>
        <td>file_data</td>
      </tr>
      <?php do { ?>
        <tr>
          <td><?php echo $row_Recordset1['image_id']; ?></td>
          <td><?php echo $row_Recordset1['filename']; ?></td>
          <td><?php echo $row_Recordset1['mime_type']; ?></td>
          <td><?php echo $row_Recordset1['file_size']; ?></td>
          <td><?php echo $row_Recordset1['file_data']; ?></td>
          <td><img src="show_image.php?image_id=<?php echo
    $row_getdetails['image_id']; ?>" alt="Image from DB" />
    </td>
        </tr>
        <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
    </table>
    </body>
    </html>
    <?php
    mysql_free_result($Recordset1);
    ?>

  • Display image from database with jspSmart

    Hi
    I have successfully uploaded and saved images into oracle(8.1.5) table DATA_TYPE(dtid number, iconname varchar2(30), icon blob). When I try to display a specific icon in my browser, I get "javax.servlet.ServletException: General error" at:
    PreparedStatement pstmt = myConnection.prepareStatement(mySQL);
    My code looks like this:
    imgModifyDataType.jsp
    <%
    ResultSet myResultSet = null;
    Statement myStatement = null;
    Connection myConnection = null;
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
    myConnection = DriverManager.getConnection("Jdbc:Odbc:Te","te","te");
    String iconName;
    String pDTID = request.getParameter("dtid");
    String mySQL = "Select iconname, icon from data_types where dtid=?";
    PreparedStatement pstmt = myConnection.prepareStatement(mySQL);
    pstmt.setString(1,pDTID);
    myResultSet = pstmt.executeQuery();
    iconName = myResultSet.getString("iconname");
    myUpload.initialize(pageContext);
    myUpload.downloadField(myResultSet,"icon","application/x-msdownload", iconName);
    %>
    I call this JSP from another JSP like this:
    <img src="imgModifyDataType.jsp?dtid=<%=pDTID%>">
    If we cannt display image with the help of another jsp like this then please guide me how to modify the imgModifyDataType.jsp to a servlet because I have never worked in servlets.
    Please help
    Sajid

    I think that it may help you get image from database. I used two jsp page. First one is getphoto.jsp that makes as table based in sql statment and invoke the getimage.jsp this last returns images based on
    the getphoto.jsp PhotoId.
    /** getphoto.jsp source code */
    <%@page import="java.sql.*,oracle.jdbc.*"%>
    <html>
    <head>
    <title>
    jsp1
    </title>
    </head>
    <body bgcolor="#ffffff">
    <table width="781" border="2">
    <tr<<td>
    <td width="83" bgcolor="#C0C0C0"><b>PhotoId</b><td width="450" bgcolor="#C0C0C0"><b>Description</b></td><td width="228" bgcolor="#C0C0C0"><b>Photo Image</b></td>
    <%
    Connection conn = null;
    Statement stmt = null;
    ResultSet rset = null;
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    conn = DriverManager.getConnection("jdbc:oracle:thin:@itas:1521:oraITAS","yourDbUserId","yourDbPassword");
    stmt = conn.createStatement();
    rset = stmt.executeQuery("select photo_id,photo_description from photo");
    while (rset.next()) {
         %>
         <tr><td width="83"><%=rset.getObject("photo_id")%></td><td width="450"><%=rset.getObject("photo_description")%></td><td width="228"><img src="getimage.jsp?PhotoId=<%=rset.getObject("photo_id")%>" width="238" height="228"></td></tr>
         <%
    conn.close();
    %>
    </table>
    </body>
    </html>
    /** getimage.jsp source code */
    <%@ page contentType="image/jpeg; chaoResult=iso-8859-1" language="java" import="java.sql.*,java.io.*,java.util.*" errorPage="" %>
    <%
    String strConnString = null;
    Connection oDbConn;
    Statement oStmt;
    ResultSet oResult;
    String strConnection = null;
    String strUserId = "c_erober";
    String strUserPwd = "sybdev99";
    String strDatabase = "oraITAS";
    String strPhotoId;
    strConnString = "jdbc:odbc:" + strDatabase;
    String strSql;
    try {
    strPhotoId = (String) request.getParameter("PhotoId");
    strSql = "select photo_image from photo" + ( (strPhotoId==null) ? " where photo_id = '001'": (" where photo_id = '" + strPhotoId + "'") );
    DriverManager.registerDriver(new sun.jdbc.odbc.JdbcOdbcDriver());
    oDbConn = DriverManager.getConnection(strConnString,strUserId,strUserPwd);
    response.setContentType("image/jpeg");
    oStmt = oDbConn.createStatement();
    oResult = oStmt.executeQuery(strSql);
    oResult.next();
    byte[] bytearray = new byte[4096];
    int size=0;
    InputStream sImage;
    sImage = oResult.getBinaryStream(1);
    response.reset();
    response.setContentType("image/jpeg");
    response.addHeader("Content-Disposition","filename=getimage.jpeg");
    while((size=sImage.read(bytearray))!= -1 ) {
    response.getOutputStream().write(bytearray,0,size);
    response.flushBuffer();
    sImage.close();
    oDbConn.close();
    } catch (SQLException ex) { ex.getMessage();
    %>

  • How can I import images from iphoto with the albums and folders?

    How can I import images from iphoto without losing the albums and folders I already created?

    In Organizer, you can choose File>get Photos and Videos>From iPhoto.
    Importing from iPhoto'09: If in iPhoto, you organize your media using photo references, that is, the media actually does not reside inside iPhoto library package, and are referenced through original locations, Organizer does not create new copies of those media and just refer to the original location. but if your iPhoto media reside inside iPhoto library, Organizer creates a copy all media in your pictures folder, also imports albums and tags and other metadata.
    Importing from iPhoto'011: In this case, Organizer always creates a copy of your photos in your pictures folder which resides inside iPohto package. It does not import the albums and other metadata like star rating, caption etc.
    Hope this information helps!
    regards,
    vaishali

  • How receive image from camera with PCI-bus

    Hello all
    Please help
    me.
    I have LV 7.1.1.
    I wont
    watch two and more images from cameras at the same time.
    I have capture
    card (PCI-bus) with 4 video-input.
    What kind
    of data must be transfered from this capture card  to LV?
     With respect
    Aleksandr.

    Hello Aleksandr
    please provide more information, what type of video card do you have?
    Have you configure the card so you can watch an image with MAX?
    I suppose the card has the ability to capture more than one image at a time is that true?, however most of the cards that I know of, have several inputs but you can only display one image at a time, you can swith between them and capture and image from another input, to capture more than one unit at a time you would need to open/close sessions with the instrument/card such that you are switching from one input to another
    vicente

Maybe you are looking for

  • Issue with Teredo Tunneling Adapter

    A lot of us are not very computer savvy, so when answering questions please try to remember that. I am getting a error 10 on my screen telling me my teredo tunneling adapter is not tunneling and  has a driver problem.  I have tried to download the dr

  • Activating SPROXY in CRM

    Hi,    I am trying to activate Sproxy in SAP-CRM System.i Have don all the nessary steps to configure but while running SPROXY Transaction it is saying no Connection to Integration Builder. IT is giving This Information 1. The address of the Integrat

  • Graphics Issues

    Seems this isn't a new problem, but since it hasn't been addressed  I thought I'd bring it up again. Using a newer 2.8 ghz iMac and when using the Steinway & Vocal setting going into perform mode cause the screen to go mad. Tried the plist removal an

  • Self programmed pre- and post trigger

    Hello, I am planning a measurement system and search some ideas for programming how to realize it. I have an older NI PCI-6024E and want to measure 8 voltage signals with 2 kHz. When task is started it should run some hours without task stop. Every 2

  • Windows newlines on files

    Hi all you there. my question is this, windows newlines and unix newlines are recognized diferent by the many editors, and platforms, windows notepad does not recognize unix newlines so when you try to open a file a mess is displayed, i've seen that