mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-04-12 15:52:29 +02:00
2020-05-21 Fred Gleason <fredg@paravelsystems.com>
* Added a check to verify correct size of imported images in 'RDFeed::importImageFile()'. Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
parent
68d707566d
commit
491a08dfed
@ -19981,3 +19981,6 @@
|
||||
2020-05-21 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Added image size and type data to the 'View Image' dialog in
|
||||
rdadmin(1).
|
||||
2020-05-21 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Added a check to verify correct size of imported images in
|
||||
'RDFeed::importImageFile()'.
|
||||
|
@ -741,7 +741,8 @@ int RDFeed::importImageFile(const QString &pathname,QString *err_msg,
|
||||
bool ok=false;
|
||||
QString sql;
|
||||
int ret;
|
||||
|
||||
QSize min=rssSchemas()->minimumImageSize(rssSchema());
|
||||
QSize max=rssSchemas()->maximumImageSize(rssSchema());
|
||||
*err_msg="OK";
|
||||
|
||||
//
|
||||
@ -749,7 +750,7 @@ int RDFeed::importImageFile(const QString &pathname,QString *err_msg,
|
||||
//
|
||||
QFile file(pathname);
|
||||
if(!file.open(QIODevice::ReadOnly)) {
|
||||
*err_msg=QString("unable to open image file [")+
|
||||
*err_msg=QString("Unable to open image file [")+
|
||||
QString(strerror(errno))+"]";
|
||||
return -1;
|
||||
}
|
||||
@ -761,7 +762,21 @@ int RDFeed::importImageFile(const QString &pathname,QString *err_msg,
|
||||
//
|
||||
QImage *img=new QImage();
|
||||
if(!img->loadFromData(data)) {
|
||||
*err_msg="invalid image file";
|
||||
*err_msg="Invalid image file!";
|
||||
return -1;
|
||||
}
|
||||
if((!min.isNull())&&
|
||||
((img->width()<min.width())||(img->height()<min.height()))) {
|
||||
*err_msg=
|
||||
QString().sprintf("Image is too small - %dx%d or larger required",
|
||||
min.width(),min.height());
|
||||
return -1;
|
||||
}
|
||||
if((!max.isNull())&&
|
||||
((img->width()>max.width())||(img->height()>max.height()))) {
|
||||
*err_msg=
|
||||
QString().sprintf("Image is too large - %dx%d or smaller required",
|
||||
max.width(),max.height());
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user