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 download an image from a .php page?
QtWS25 Last Chance

How to download an image from a .php page?

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 2 Posters 460 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.
  • K Offline
    K Offline
    Kayote
    wrote on last edited by Kayote
    #1

    I am using QNetworkAccessManager to download images which I display in a label widget.
    This works for images that have an url ending with the file type:

    QNetworkRequest request(QUrl("http://my-url.png"));
    manager->get(request);
    

    @ Slot:

    QPixmap image;
    image.loadFromData(reply->readAll());
    
    ui->lblPic->setPixmap(image);
    

    But some of these images are on a .php that returns a png image, and this doesn't work for those. So how would I make it work for those?

    Thanks in advance.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mcosta
      wrote on last edited by
      #2

      HI and welcome to devnet,

      But some of these images are on a .php that returns a png image,

      can you explain better?? One example?
      Probably you have to pass some query parameters to the GET URL

      Once your problem is solved don't forget to:

      • Mark the thread as SOLVED using the Topic Tool menu
      • Vote up the answer(s) that helped you to solve the issue

      You can embed images using (http://imgur.com/) or (http://postimage.org/)

      1 Reply Last reply
      0

      • Login

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