Announcement

Collapse
No announcement yet.

change image according to the data

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • change image according to the data

    Hi,

    i am trying to show an image according to the data i get out of the database.

    i used a html-image-field, but now i dont know how to change he image accordingly... i set one image up in the field itself and the image is in the grid no matter what data is in the field.

    i only want to show two differenz pictures instead of zero/one.

    could i use {field} = sc_image("my_image_name") ?

    thanks, mati

  • #2
    Re: change image according to the data

    Mati,
    You can change the image dynamically as below
    1. Create a Field as Image file name (it means you have to pass a image filename)
    2. In the SQL you are passing to the application, In your input SQL, change the Imagename based onthe database value and assign to Image file name field

    It works fine for me,..

    Regards
    Dhana

    Comment


    • #3
      Re: change image according to the data

      Here is an example I created for adding an image to a grid:
      http://www.scriptcase.net/forum_en_u...p?topic=1642.0

      Regards,
      Scott.

      Comment


      • #4
        Good Day, please the link not work.

        Comment


        • #5
          Hi,

          You can try this code :
          //upload field is blob field

          $id = 1;
          $check_sql = "SELECT upload FROM upload WHERE id=$id";
          sc_lookup(rs, $check_sql);

          if (isset({rs[0][0]}))
          {
          $image = {rs[0][0]};
          }

          $img = imagecreatefromstring($image);
          imagejpeg($img, '../_lib/img/simpletext.png',100);
          sc_image('simpletext.png');

          // now you can use this picture in menu
          //sc_appmenu_add_item($menu,'itm_7','itm_0',' Child_Label',,,'simpletext.png');

          // this code was fine for my project

          Comment


          • #6
            Hi, ionuberlea. thanks you write.
            i have problem the field type image file,

            y like use field type file name image o ther solutions and not understand how use.
            I have folder for producid and exist file name equal value field. example producid=1478 the file image in folder 1478.jpg o 1478.png.

            i like add column in grid, in view image the product table.
            i not know how to use field type file image name.

            I not have filed type blob my database, all files exist in folder. 24000 files png.

            you can help me?, thanks.

            Comment

            Working...
            X