Ask a Question related to Macromedia Flash Data Integration, Design and Development.

  1. #1

    Default images in database

    Is there a tutorial somewhere that tells/shows how to display an image from a
    db. I have my image paths in a mysql db and I am using php to display my other
    text fields. I just haven't been able to get my images to show. Below is the
    code that I am using so far. Here is my actual goal, I am trying to have a
    flash document the has a list in the datagrid that is connected to a mysql db.
    I have successfully done this. When a user clicks on a product in the datagrid
    it populates the details below the grid and I have done so successfully. What I
    now need is to show a picture of the product in the details section. I would
    also like to see how to show different images for different vendors, each
    vendor has its own image size, so if I put just one image placeholder then some
    of the images will be scewed. I need something that shows image in placeholder
    1 if company=1, show image in placeholder 2 if company=2, etc.


    /*This defines the location of the files we are going
    to use in this program. */
    _global.mypath = "http://www.producttestsite.com/flash/"
    //This defines the datagrid columns
    import mx.controls.DataGrid;
    import mx.controls.gridclasses.DataGridColumn;
    var column = new DataGridColumn("j1");
    column.headerText = "Product Name";
    column.width = 200;
    tf.align = "center";
    products.addColumn(column);
    var column = new DataGridColumn("j2");
    column.headerText = "Price";
    column.width = 60;
    products.addColumn(column);
    var column = new DataGridColumn("j3");
    column.headerText = "Color";
    column.width = 75;
    products.addColumn(column);
    var column = new DataGridColumn("j4");
    column.headerText = "Interior Color";
    column.width = 150;
    products.addColumn(column);
    products.addEventListener("headerRelease", headerListener);
    products.dataProvider = r_string;
    products.scrollToTop();
    products.dataProvider = r_string;
    //set Column text property
    //var tf = new TextFormat ();
    //tf.italic = False;
    //tf.bold = False;
    //tf.align
    // This reads the data from the PHP script and populates the datagrid.
    var sendData = new LoadVars();
    var r_string = new LoadVars();
    r_string.onLoad = getResponse;
    sendData.addr = propDgrid.selectedItem.j2
    job_id_num=custDgrid.selectedItem.cust_id;
    mypath89 =_global.mypath + "products.php";
    sendData.sendAndLoad(mypath89, r_string, "post");
    function getResponse(result){
    if (result == true) {
    var r_string = new Array();
    for (var i:Number=0; i < this.n; i++) {
    r_string.push(
    { productid:this["productid"+i],
    j1:this["model"+i],
    j2:this["price"+i],
    j3:this["color"+i],
    j4:this["interiordesc"+i]
    })};
    }
    products.dataProvider = r_string;
    }
    //Populate the form
    //==============Show Customer Details=========================
    custf=function(){
    var sendData = new LoadVars();
    var recData = new LoadVars();
    recData.onLoad = getResponse1;
    sendData.productid = products.selectedItem.productid;
    mypath81 =_global.mypath + "productform.php";
    sendData.sendAndLoad(mypath81, recData, "post");
    }
    function getResponse1(result){
    if (result == true) {
    model.text = this['model'];
    price.text = this['price'];
    material.text = this['material'];
    interiordesc.text = this['interiordesc'];
    this.ref['holder_mc'+i].loadMovie(this['picture'+i])
    picture.text = this['picture'];
    feature1.text = this['feature1'];
    feature2.text = this['feature2'];
    feature3.text = this['feature3'];
    feature4.text = this['feature4'];
    }
    }
    products.addEventListener("cellPress",custf);
    /*I have not shown all fields in the database on the form but if you wanted to
    show more of the fields you would just add then to the list above.*/

    fsl2227 Guest

  2. Similar Questions and Discussions

    1. Resizing Images From a database
      Hi, can anyone help me? I have a load of images in a database which is linked and displayed to a webpage, but the images are all one size (too...
    2. FLASH & ASP - Database Images
      I have a little problem with displaying asp results in flash, I hope someone can help me. I've managed to display images referenced in a database in...
    3. Images, PDf, etc in a database
      Hi all, We picked up a project were we would need to store all files like Images, PDF, Word files in a database (Oracle or MS SQL). All fine so...
    4. Images in a database
      Ok, I had a more barebones version of this script working, but when I tried to put it in with my larger script, it broke. I think the problem lies...
    5. Images from a database
      Hi everyone. I have just discovered how to display an image from a database in the browser....changing the contenttype to "image/jpeg" and then...
  3. #2

    Default Re: images in database

    This is how we got it to work. I am no PHP expert, but this does pull the
    variable and place the image.


    <?php $isImage = $row_Recordset1['Image'];
    if ($isImage != 0) { // Show if recordset not empty ?>
    </span></p>

    <table width="120" height="120" align="left" >
    <tr>
    <td width="10" height="21"></td>
    <td width="98"><span class="header"><img src="images/<?php
    echo $row_Recordset1['Image']; ?>"></span></td>
    </tr>
    </table>



    Andrew_Bower Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139