#include "picturemodel.h"

#include <QFile>
#include <QImageReader>

PictureModel::PictureModel(QObject *parent)
    : MediaModel(MediaModel::Picture, parent)
{
    QHash<int, QByteArray> roleNames = MediaModel::roleNames();
    setRoleNames(roleNames);
}

PictureModel::~PictureModel()
{
}

QVariant PictureModel::data(MediaInfo *mediaInfo, int role) const
{
    if (role == Qt::DisplayRole)
        return mediaInfo->name;
    return QVariant();
}

QImage PictureModel::decoration(MediaInfo *info) const
{
    return (static_cast<PictureInfo *>(info))->thumbnail;
}

MediaInfo *PictureModel::readMediaInfo(const QString &filePath)
{
    QImageReader imageReader(filePath);
    if (!imageReader.canRead())
        return 0;

    QImage image = imageReader.read();
    if (image.isNull())
        return 0;

    PictureInfo *info = new PictureInfo;
    info->thumbnail = image;

    return info;
}


#include "picturemodel.h"

#include <QFile>

PictureModel::PictureModel(QObject *parent)
    : MediaModel(MediaModel::Picture, parent)
{
    QHash<int, QByteArray> roleNames = MediaModel::roleNames();
    setRoleNames(roleNames);
}

PictureModel::~PictureModel()
{
}

QVariant PictureModel::data(MediaInfo *mediaInfo, int role) const
{
    if (role == Qt::DisplayRole)
        return mediaInfo->name;
    return QVariant();
}

QImage PictureModel::decoration(MediaInfo *info) const
{
    QImage thumbnail = (static_cast<PictureInfo *>(info))->thumbnail;
    if (thumbnail.isNull())
        return QImage(themeResourcePath() + "/media/Fanart_Fallback_Picture_Small.jpg"); // FIXME: Make this configurable
    return thumbnail;
}

MediaInfo *PictureModel::readMediaInfo(const QString &filePath)
{
    QImage image(filePath);
    
    PictureInfo *info = new PictureInfo;
    info->thumbnail = image;

    return info;
}


--- 
+++ 
@@ -1,6 +1,7 @@
 #include "picturemodel.h"
 
 #include <QFile>
+#include <QImageReader>
 
 PictureModel::PictureModel(QObject *parent)
     : MediaModel(MediaModel::Picture, parent)
@@ -22,16 +23,19 @@
 
 QImage PictureModel::decoration(MediaInfo *info) const
 {
-    QImage thumbnail = (static_cast<PictureInfo *>(info))->thumbnail;
-    if (thumbnail.isNull())
-        return QImage(themeResourcePath() + "/media/Fanart_Fallback_Picture_Small.jpg"); // FIXME: Make this configurable
-    return thumbnail;
+    return (static_cast<PictureInfo *>(info))->thumbnail;
 }
 
 MediaInfo *PictureModel::readMediaInfo(const QString &filePath)
 {
-    QImage image(filePath);
-    
+    QImageReader imageReader(filePath);
+    if (!imageReader.canRead())
+        return 0;
+
+    QImage image = imageReader.read();
+    if (image.isNull())
+        return 0;
+
     PictureInfo *info = new PictureInfo;
     info->thumbnail = image;
 
Use ImageReader to read the images
