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
Re: Download image synchronously, check size and resize it in Qt.
Quote:
Originally Posted by
moreo
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
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
3) Sequre file (eg to prevent some bash script injections etc).
Whatever that means
Quote:
Originally Posted by
moreo
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,
_
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.
Re: Download image synchronously, check size and resize it in Qt.
Quote:
Originally Posted by
moreo
It's a console application and operations should go step by step.
I don't see how it requires the process to be synchronous.