Skip to content

Commit

Permalink
Create badge thumbnail - refs BT#9082
Browse files Browse the repository at this point in the history
  • Loading branch information
AngelFQC committed Feb 18, 2015
1 parent 70f25d0 commit 1ca9fe7
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions main/admin/skill_badge_create.php
Expand Up @@ -44,7 +44,7 @@
}

$fileDir = "badges/";
$fileName = sha1($_POST['name']) . ".png";
$fileName = sha1($_POST['name']);

$existsBadgesDirectory = is_dir($sysDataPath . 'badges/');

Expand All @@ -62,10 +62,18 @@
}
}

$imageExtraField = new Image($_FILES['image']['tmp_name']);
$imageExtraField->send_image($sysDataPath . $fileDir . $fileName, -1, 'png');
$skillImagePath = sprintf("%s%s%s.png", $sysDataPath, $fileDir, $fileName);

$params['icon'] = $fileDir . $fileName;
$skillImage = new Image($_FILES['image']['tmp_name']);
$skillImage->send_image($skillImagePath, -1, 'png');

$skillThumbPath = sprintf("%s%s%s-small.png", $sysDataPath, $fileDir, $fileName);

$skillImageThumb = new Image($skillImagePath);
$skillImageThumb->resize(ICON_SIZE_SMALL, ICON_SIZE_SMALL);
$skillImageThumb->send_image($skillThumbPath);

$params['icon'] = sprintf("%s%s.png", $fileDir, $fileName);
} else {
Session::write('errorMessage', get_lang('UplUnableToSaveFile'));
}
Expand Down

0 comments on commit 1ca9fe7

Please sign in to comment.