Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. how to insert an image in a QFile generated file using HTML
Forum Updated to NodeBB v4.3 + New Features

how to insert an image in a QFile generated file using HTML

Scheduled Pinned Locked Moved Solved General and Desktop
24 Posts 3 Posters 3.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ManiRonM ManiRon

    @jsulm No sir, I will generate a html file with that code but in that html code i want to place or display an image . I tried but its not displaying

    jsulmJ Online
    jsulmJ Online
    jsulm
    Lifetime Qt Champion
    wrote on last edited by
    #13

    @ManiRon said in how to insert an image in a QFile generated file using HTML:

    I tried but its not displaying

    So, I guess by "displaying" you mean in a web browser?
    Where exactly is the image file located? Is it in the same directory as the HTML file?

    https://forum.qt.io/topic/113070/qt-code-of-conduct

    ManiRonM 1 Reply Last reply
    0
    • jsulmJ jsulm

      @ManiRon said in how to insert an image in a QFile generated file using HTML:

      I tried but its not displaying

      So, I guess by "displaying" you mean in a web browser?
      Where exactly is the image file located? Is it in the same directory as the HTML file?

      ManiRonM Offline
      ManiRonM Offline
      ManiRon
      wrote on last edited by
      #14

      @jsulm yes

      jsulmJ 1 Reply Last reply
      0
      • ManiRonM ManiRon

        @jsulm yes

        jsulmJ Online
        jsulmJ Online
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #15

        @ManiRon I asked 3 questions. To which question does "yes" belong?

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        ManiRonM 2 Replies Last reply
        0
        • jsulmJ jsulm

          @ManiRon I asked 3 questions. To which question does "yes" belong?

          ManiRonM Offline
          ManiRonM Offline
          ManiRon
          wrote on last edited by
          #16

          @jsulm

          So, I guess by "displaying" you mean in a web browser? yes
          Where exactly is the image file located? from where i am running my application
          Is it in the same directory as the HTML file? No

          jsulmJ 1 Reply Last reply
          0
          • ManiRonM ManiRon

            @jsulm

            So, I guess by "displaying" you mean in a web browser? yes
            Where exactly is the image file located? from where i am running my application
            Is it in the same directory as the HTML file? No

            jsulmJ Online
            jsulmJ Online
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #17

            @ManiRon said in how to insert an image in a QFile generated file using HTML:

            Is it in the same directory as the HTML file? No

            Well, then I would say this is the problem (and I already said that before: "the picture must be in the same directory as the HTML document!").

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            ManiRonM 1 Reply Last reply
            0
            • jsulmJ jsulm

              @ManiRon I asked 3 questions. To which question does "yes" belong?

              ManiRonM Offline
              ManiRonM Offline
              ManiRon
              wrote on last edited by
              #18

              @jsulm if i simply give this <img src="Logo1.png" alt="Test" > i have to place my image at place where i am saving my html file . But if i give the path its not accepting at all(means its not showing the image at all)

              jsulmJ 1 Reply Last reply
              0
              • jsulmJ jsulm

                @ManiRon said in how to insert an image in a QFile generated file using HTML:

                Is it in the same directory as the HTML file? No

                Well, then I would say this is the problem (and I already said that before: "the picture must be in the same directory as the HTML document!").

                ManiRonM Offline
                ManiRonM Offline
                ManiRon
                wrote on last edited by ManiRon
                #19

                @jsulm
                QString Header = "<img src="D:/APP/Image" alt="Test" >";

                Like this if i mention its not displaying the image

                1 Reply Last reply
                0
                • ManiRonM ManiRon

                  @jsulm if i simply give this <img src="Logo1.png" alt="Test" > i have to place my image at place where i am saving my html file . But if i give the path its not accepting at all(means its not showing the image at all)

                  jsulmJ Online
                  jsulmJ Online
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by
                  #20

                  @ManiRon "i have to place my image at place where i am saving my html file" - yes!
                  How can web browser know where the picture is if the only information you give it is the file name without path:

                  <img src="Logo1.png" alt="Test" >
                  

                  ?! So, where should web browser look for this picture?
                  "But if i give the path its not accepting at all" - how do you give it the path? Please show...

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  ManiRonM 2 Replies Last reply
                  0
                  • jsulmJ jsulm

                    @ManiRon "i have to place my image at place where i am saving my html file" - yes!
                    How can web browser know where the picture is if the only information you give it is the file name without path:

                    <img src="Logo1.png" alt="Test" >
                    

                    ?! So, where should web browser look for this picture?
                    "But if i give the path its not accepting at all" - how do you give it the path? Please show...

                    ManiRonM Offline
                    ManiRonM Offline
                    ManiRon
                    wrote on last edited by
                    #21
                    This post is deleted!
                    1 Reply Last reply
                    0
                    • jsulmJ jsulm

                      @ManiRon "i have to place my image at place where i am saving my html file" - yes!
                      How can web browser know where the picture is if the only information you give it is the file name without path:

                      <img src="Logo1.png" alt="Test" >
                      

                      ?! So, where should web browser look for this picture?
                      "But if i give the path its not accepting at all" - how do you give it the path? Please show...

                      ManiRonM Offline
                      ManiRonM Offline
                      ManiRon
                      wrote on last edited by
                      #22

                      @jsulm 0_1550815642494_Untitled.png

                      jsulmJ 1 Reply Last reply
                      0
                      • ManiRonM ManiRon

                        @jsulm 0_1550815642494_Untitled.png

                        jsulmJ Online
                        jsulmJ Online
                        jsulm
                        Lifetime Qt Champion
                        wrote on last edited by jsulm
                        #23

                        @ManiRon Why don't you put the image into same directory as your HTML document or into a subdirectory there? I don't see the point to spread HTML and images over completely different locations as they belong together to build a HTML page.
                        See https://www.w3schools.com/html/html_filepaths.asp for possibilities HTML provides.
                        The syntax you're using is invalid.

                        https://forum.qt.io/topic/113070/qt-code-of-conduct

                        ManiRonM 1 Reply Last reply
                        1
                        • jsulmJ jsulm

                          @ManiRon Why don't you put the image into same directory as your HTML document or into a subdirectory there? I don't see the point to spread HTML and images over completely different locations as they belong together to build a HTML page.
                          See https://www.w3schools.com/html/html_filepaths.asp for possibilities HTML provides.
                          The syntax you're using is invalid.

                          ManiRonM Offline
                          ManiRonM Offline
                          ManiRon
                          wrote on last edited by
                          #24

                          @jsulm Thank you sir , I have been giving the path wrongly , It worked below is the code i used

                          0_1550816775844_Untitled.png

                          1 Reply Last reply
                          1

                          • Login

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Groups
                          • Search
                          • Get Qt Extensions
                          • Unsolved