Andromo - Start Making Apps - Free Signup

Announcement

Collapse
No announcement yet.

how to show image name ???

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

  • how to show image name ???

    hi,
    how can I show image names in a label or text..

    for example : mypicture.jpg I want to take "mypicture" and show it in an area...so when we selected any image ,image name will be appear...

    it wont be object name, will be images own names...
    please help...
    I searched but couldnt find in forum...

  • #2
    santral -

    This code gets the properties of the object "Image1" and stores them in a table called iProps. The entire path and name of the image will be returned. If you just want the name, you will have to use a string function to extact it.

    Code:
    iProps = Image.GetProperties("Image1")
    Dialog.Message("Image Name: ", ""..iProps.ImageFile)
    This should get you started. HTH
    Last edited by holtgrewe; 12-09-2007, 10:11 AM.

    Comment


    • #3
      thanks for reply.
      can you give me an exmaple of sitring function to dont show entire path...
      I couldnt take only imagename from "/Autoplay/Images/imagename.jpg"
      could you help pls !!!

      Comment


      • #4
        Hey there you Two.

        for the Avatars i think u are realated some how are you family or something.
        do work at same place.

        well any how how i wish you well

        Comment


        • #5
          Santral
          Here's something you may try:

          Code:
          iProps = Image.GetProperties("Image1")
          title = String.Right(iProps.ImageFile, (String.Length(iProps.ImageFile) - String.ReverseFind(iProps.ImageFile, "\\", true)));
          Dialog.Message("Image Name: ", ""..title)
          hth

          Comment


          • #6
            really thanks holtgrewe
            it helped me...
            and the final code :
            dynamic label for each image

            PHP Code:
            function imgname ()
            iProps Image.GetProperties("Image1")
            title String.Right(iProps.ImageFile, (String.Length(iProps.ImageFile) - String.ReverseFind(iProps.ImageFile"\\"true)));
            Label.SetText("Label1",""..title);
            end 
            thanks again holtgrewe ....

            Comment


            • #7
              and I wrote a new one
              in previous one text was image.jpg
              now the new one without .jpg ->

              PHP Code:
              function isim ()
              iProps Image.GetProperties("Image1")
              uzunluk String.Length(iProps.ImageFile) - String.ReverseFind(iProps.ImageFile"\\"true);
              title String.Right(iProps.ImageFileuzunluk );
              tek String.Left(""..title ,uzunluk );
              Label.SetText("Label1",""..tek);
              end 
              Is it good code, holtgrewe ? did I learn this work!

              Comment


              • #8
                heeyyy....
                when I build it ,names changed and become ap20,ap30,......
                how can we solve this problem ???

                Comment


                • #9
                  The code appears to be okay; however the function will only work with "Image1" and "Label1" the way it is coded. If you want this to work with multiple Images, you will need to pass the Object names in the function.

                  Check the help file on how to create functions:

                  Here's one way - maybe not the most efficient...

                  PHP Code:
                  function isim (imglbl
                  iProps Image.GetProperties(""..img
                  uzunluk String.Length(iProps.ImageFile) - String.ReverseFind(iProps.ImageFile"\\"true); 
                  title String.Right(iProps.ImageFileuzunluk ); 
                  tek String.Left(""..title ,uzunluk ); 
                  Label.SetText(""..lbl,""..tek); 
                  end 

                  Then when calling the function use:
                  PHP Code:
                  function("Image1""Label1")
                  -- 
                  etc.
                  function(
                  "Image6""Label6")
                  --
                  etc
                  I have not tested this, so you may have to tweak it some to get it to work for you.

                  HTH

                  Comment


                  • #10
                    thanks holtgrewe...you r very helpful..
                    I could solve this problem. I made a LargeImage and all images goes here when clicked,so I only used LargeImage in code...and one function that you give is enough for me,and worked quite good....

                    BUT the main problem becomes after building..... There are .dat file names instead of image names
                    for example before build ; name = mypicture1 or mypicture2 ...etc
                    after build ; name = ap45 or ap46 .....etc

                    how to solve this problem ???

                    Comment


                    • #11
                      I suggest you do not include your pictures in the project when publishing.
                      Instead, keep them in the source folder so you could load them using

                      Code:
                      -- example
                      Image.Load("Image1", "AutoPlay\\Images\\indigorose.png");
                      If you do not want users to be able to edit/open the pictures i suggest you create a .zip archive and add all your pictures inside.
                      If so, you could use something like

                      Code:
                      --[[ lets assume your password for the zip file "imgs.zip" is "mypassword" ]]--
                      zipfile = (_SourceFolder.."\\imgs.zip") --where the file that has all the pictures in
                      Zip.Extract(zipfile, {"*.*"}, _TempFolder, true, true, "mypassword", ZIP_OVERWRITE_ALWAYS, nil);

                      Comment

                      Working...
                      X