mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02:00
placing uploaded images in different directory from previously uploaded
images to differentiate between bordered and borderless images
This commit is contained in:
parent
34e85ecd53
commit
4e95baef3c
1 changed files with 5 additions and 17 deletions
|
@ -182,22 +182,10 @@ function save_profile_image($id, $uploadmanager, $dir='users') {
|
|||
ImageCopyBicubic($im1, $im, 0, 0, $cx-$half, $cy-$half, 100, 100, $half*2, $half*2);
|
||||
ImageCopyBicubic($im2, $im, 0, 0, $cx-$half, $cy-$half, 35, 35, $half*2, $half*2);
|
||||
|
||||
// Draw borders over the top.
|
||||
$black1 = ImageColorAllocate ($im1, 0, 0, 0);
|
||||
$black2 = ImageColorAllocate ($im2, 0, 0, 0);
|
||||
ImageLine ($im1, 0, 0, 0, 99, $black1);
|
||||
ImageLine ($im1, 0, 99, 99, 99, $black1);
|
||||
ImageLine ($im1, 99, 99, 99, 0, $black1);
|
||||
ImageLine ($im1, 99, 0, 0, 0, $black1);
|
||||
ImageLine ($im2, 0, 0, 0, 34, $black2);
|
||||
ImageLine ($im2, 0, 34, 34, 34, $black2);
|
||||
ImageLine ($im2, 34, 34, 34, 0, $black2);
|
||||
ImageLine ($im2, 34, 0, 0, 0, $black2);
|
||||
|
||||
if (ImageJpeg($im1, $CFG->dataroot .'/'. $dir .'/'. $id .'/f1.jpg', 90) and
|
||||
ImageJpeg($im2, $CFG->dataroot .'/'. $dir .'/'. $id .'/f2.jpg', 95) ) {
|
||||
@chmod($CFG->dataroot .'/'. $dir .'/'. $id .'/f1.jpg', 0666);
|
||||
@chmod($CFG->dataroot .'/'. $dir .'/'. $id .'/f2.jpg', 0666);
|
||||
if (ImageJpeg($im1, $CFG->dataroot .'/'. $dir .'/'. $id .'/user100.jpg', 90) and
|
||||
ImageJpeg($im2, $CFG->dataroot .'/'. $dir .'/'. $id .'/user35.jpg', 95) ) {
|
||||
@chmod($CFG->dataroot .'/'. $dir .'/'. $id .'/user100.jpg', 0666);
|
||||
@chmod($CFG->dataroot .'/'. $dir .'/'. $id .'/user35.jpg', 0666);
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
|
@ -205,4 +193,4 @@ function save_profile_image($id, $uploadmanager, $dir='users') {
|
|||
}
|
||||
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue