Results 1 to 4 of 4

Thread: Download image synchronously, check size and resize it in Qt.

  1. #1
    Join Date
    May 2015
    Posts
    2

    Default Download image synchronously, check size and resize it in Qt.

    Hello. I'm new to qt. First of all sorry for my english.

    I want to download image from remote server synchronously.

    For this i need:
    1) Check size of image before downloading (Cancel downloading if size is bigger then some limit)
    2) Download SYNCHRONOUSLY (In my case I need this instead asynchronous)
    3) Sequre file (eg to prevent some bash script injections etc).
    4) Resize image to some default value (eg. reduce to some MaxWidth and MaxHeight or MaxKb if need) and convert to jpg (if file is png or something else).

    How can I do this with Qt way?
    I have read about QNetworkAccessManager and other classes, but I found only info about asynchronous download (using slots and signals).
    Thank you.

    P.S. I'm writing qt console application

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Download image synchronously, check size and resize it in Qt.

    Quote Originally Posted by moreo View Post
    1) Check size of image before downloading (Cancel downloading if size is bigger then some limit)
    Either by doing a head() call first or by deciding once you receive progress information.

    Quote Originally Posted by moreo View Post
    2) Download SYNCHRONOUSLY (In my case I need this instead asynchronous)
    You can always make an asynchronous operation synchronous, but why would you want to do that?

    Quote Originally Posted by moreo View Post
    3) Sequre file (eg to prevent some bash script injections etc).
    Whatever that means

    Quote Originally Posted by moreo View Post
    4) Resize image to some default value (eg. reduce to some MaxWidth and MaxHeight or MaxKb if need) and convert to jpg (if file is png or something else).
    QImage can do that.

    Cheers,
    _

  3. #3
    Join Date
    May 2015
    Posts
    2

    Default Re: Download image synchronously, check size and resize it in Qt.

    Thanky you for replay.

    I need synchronous approach because of my application workflow (Yes, may be it would be better to rewrite but I have no time). It's a console application and operations should go step by step.

    Ok, I will try, thanks.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Download image synchronously, check size and resize it in Qt.

    Quote Originally Posted by moreo View Post
    It's a console application and operations should go step by step.
    I don't see how it requires the process to be synchronous.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. How to check the file to download from ftp site exists ?
    By nikhilqt in forum Qt Programming
    Replies: 29
    Last Post: 8th November 2014, 10:47
  2. Replies: 1
    Last Post: 29th December 2013, 19:06
  3. Replies: 2
    Last Post: 8th December 2013, 06:53
  4. QLibrary: how to download and check?
    By lucky_sever in forum Qt Programming
    Replies: 24
    Last Post: 18th April 2012, 08:03
  5. Replies: 1
    Last Post: 13th August 2010, 07:33

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.