added: a new winix function: imgcrop

for cropping images (and thumbnails)
       www.domain.com/dir/file.jpg/imgcrop  -- crop an image
       www.domain.com/dir/file.jpg/imgcrop/thumb  -- crop an image's thumbnail
       www.domain.com/dir/file.jpg/imgcrop/newthumb  -- crop and create a new thumbnail (from an original image)
       www.domain.com/dir/imgcrop -- show images' list with above options
added: to Image class: some methods for cropping




git-svn-id: svn://ttmath.org/publicrep/winix/trunk@919 e52654a7-88a9-db11-a3e9-0013d4bc506e
pull/3/head 0.5.4
Tomasz Sowa 10 years ago
parent 8d9a021eab
commit 495499d12f

@ -34,13 +34,13 @@ app.o: ../functions/adduser.h ../functions/cat.h ../functions/chmod.h
app.o: ../functions/privchanger.h ../functions/chown.h
app.o: ../functions/ckeditor.h ../functions/cp.h ../functions/default.h
app.o: ../functions/download.h ../functions/emacs.h ../functions/env.h
app.o: ../functions/last.h ../functions/login.h ../functions/logout.h
app.o: ../functions/ln.h ../functions/ls.h ../functions/man.h
app.o: ../functions/meta.h ../functions/mkdir.h ../functions/mv.h
app.o: ../functions/nicedit.h ../functions/node.h ../functions/passwd.h
app.o: ../functions/priv.h ../functions/pw.h ../functions/reload.h
app.o: ../functions/rm.h ../functions/rmuser.h ../functions/sort.h
app.o: ../functions/specialdefault.h ../functions/stat.h
app.o: ../functions/imgcrop.h ../functions/last.h ../functions/login.h
app.o: ../functions/logout.h ../functions/ln.h ../functions/ls.h
app.o: ../functions/man.h ../functions/meta.h ../functions/mkdir.h
app.o: ../functions/mv.h ../functions/nicedit.h ../functions/node.h
app.o: ../functions/passwd.h ../functions/priv.h ../functions/pw.h
app.o: ../functions/reload.h ../functions/rm.h ../functions/rmuser.h
app.o: ../functions/sort.h ../functions/specialdefault.h ../functions/stat.h
app.o: ../functions/subject.h ../functions/template.h ../functions/tinymce.h
app.o: ../functions/uname.h ../functions/upload.h ../functions/uptime.h
app.o: ../functions/who.h ../functions/vim.h ../core/htmlfilter.h
@ -100,14 +100,14 @@ config.o: ../functions/adduser.h ../functions/cat.h ../functions/chmod.h
config.o: ../functions/privchanger.h ../functions/chown.h
config.o: ../functions/ckeditor.h ../functions/cp.h ../functions/default.h
config.o: ../functions/download.h ../functions/emacs.h ../functions/env.h
config.o: ../functions/last.h ../functions/login.h ../functions/logout.h
config.o: ../functions/ln.h ../functions/ls.h ../functions/man.h
config.o: ../functions/meta.h ../functions/mkdir.h ../functions/mv.h
config.o: ../functions/nicedit.h ../functions/node.h ../functions/passwd.h
config.o: ../functions/priv.h ../functions/pw.h ../functions/reload.h
config.o: ../functions/rm.h ../functions/rmuser.h ../functions/sort.h
config.o: ../functions/specialdefault.h ../functions/stat.h
config.o: ../functions/subject.h ../functions/template.h
config.o: ../functions/imgcrop.h ../functions/last.h ../functions/login.h
config.o: ../functions/logout.h ../functions/ln.h ../functions/ls.h
config.o: ../functions/man.h ../functions/meta.h ../functions/mkdir.h
config.o: ../functions/mv.h ../functions/nicedit.h ../functions/node.h
config.o: ../functions/passwd.h ../functions/priv.h ../functions/pw.h
config.o: ../functions/reload.h ../functions/rm.h ../functions/rmuser.h
config.o: ../functions/sort.h ../functions/specialdefault.h
config.o: ../functions/stat.h ../functions/subject.h ../functions/template.h
config.o: ../functions/tinymce.h ../functions/uname.h ../functions/upload.h
config.o: ../functions/uptime.h ../functions/who.h ../functions/vim.h
config.o: ../core/htmlfilter.h ../templates/templates.h
@ -215,20 +215,20 @@ image.o: ../functions/adduser.h ../functions/cat.h ../functions/chmod.h
image.o: ../functions/privchanger.h ../functions/chown.h
image.o: ../functions/ckeditor.h ../functions/cp.h ../functions/default.h
image.o: ../functions/download.h ../functions/emacs.h ../functions/env.h
image.o: ../functions/last.h ../functions/login.h ../functions/logout.h
image.o: ../functions/ln.h ../functions/ls.h ../functions/man.h
image.o: ../functions/meta.h ../functions/mkdir.h ../functions/mv.h
image.o: ../functions/nicedit.h ../functions/node.h ../functions/passwd.h
image.o: ../functions/priv.h ../functions/pw.h ../functions/reload.h
image.o: ../functions/rm.h ../functions/rmuser.h ../functions/sort.h
image.o: ../functions/specialdefault.h ../functions/stat.h
image.o: ../functions/subject.h ../functions/template.h
image.o: ../functions/imgcrop.h ../functions/last.h ../functions/login.h
image.o: ../functions/logout.h ../functions/ln.h ../functions/ls.h
image.o: ../functions/man.h ../functions/meta.h ../functions/mkdir.h
image.o: ../functions/mv.h ../functions/nicedit.h ../functions/node.h
image.o: ../functions/passwd.h ../functions/priv.h ../functions/pw.h
image.o: ../functions/reload.h ../functions/rm.h ../functions/rmuser.h
image.o: ../functions/sort.h ../functions/specialdefault.h
image.o: ../functions/stat.h ../functions/subject.h ../functions/template.h
image.o: ../functions/tinymce.h ../functions/uname.h ../functions/upload.h
image.o: ../functions/uptime.h ../functions/who.h ../functions/vim.h
image.o: ../core/htmlfilter.h ../templates/templates.h
image.o: ../templates/patterncacher.h ../templates/indexpatterns.h
image.o: ../templates/patterns.h ../templates/changepatterns.h
image.o: ../templates/htmltextstream.h ../core/sessionmanager.h
image.o: ../templates/htmltextstream.h ../core/sessionmanager.h lock.h
ipbancontainer.o: ipbancontainer.h ipban.h log.h textstream.h
ipbancontainer.o: logmanipulators.h ../../pikotools/textstream/textstream.h
ipbancontainer.o: ../../pikotools/space/space.h ../../pikotools/date/date.h
@ -285,13 +285,13 @@ job.o: ../functions/adduser.h ../functions/cat.h ../functions/chmod.h
job.o: ../functions/privchanger.h ../functions/chown.h
job.o: ../functions/ckeditor.h ../functions/cp.h ../functions/default.h
job.o: ../functions/download.h ../functions/emacs.h ../functions/env.h
job.o: ../functions/last.h ../functions/login.h ../functions/logout.h
job.o: ../functions/ln.h ../functions/ls.h ../functions/man.h
job.o: ../functions/meta.h ../functions/mkdir.h ../functions/mv.h
job.o: ../functions/nicedit.h ../functions/node.h ../functions/passwd.h
job.o: ../functions/priv.h ../functions/pw.h ../functions/reload.h
job.o: ../functions/rm.h ../functions/rmuser.h ../functions/sort.h
job.o: ../functions/specialdefault.h ../functions/stat.h
job.o: ../functions/imgcrop.h ../functions/last.h ../functions/login.h
job.o: ../functions/logout.h ../functions/ln.h ../functions/ls.h
job.o: ../functions/man.h ../functions/meta.h ../functions/mkdir.h
job.o: ../functions/mv.h ../functions/nicedit.h ../functions/node.h
job.o: ../functions/passwd.h ../functions/priv.h ../functions/pw.h
job.o: ../functions/reload.h ../functions/rm.h ../functions/rmuser.h
job.o: ../functions/sort.h ../functions/specialdefault.h ../functions/stat.h
job.o: ../functions/subject.h ../functions/template.h ../functions/tinymce.h
job.o: ../functions/uname.h ../functions/upload.h ../functions/uptime.h
job.o: ../functions/who.h ../functions/vim.h ../core/htmlfilter.h
@ -433,14 +433,15 @@ mounts.o: ../functions/functionparser.h ../core/cur.h ../functions/adduser.h
mounts.o: ../functions/cat.h ../functions/chmod.h ../functions/privchanger.h
mounts.o: ../functions/chown.h ../functions/ckeditor.h ../functions/cp.h
mounts.o: ../functions/default.h ../functions/download.h ../functions/emacs.h
mounts.o: ../functions/env.h ../functions/last.h ../functions/login.h
mounts.o: ../functions/logout.h ../functions/ln.h ../functions/ls.h
mounts.o: ../functions/man.h ../functions/meta.h ../functions/mkdir.h
mounts.o: ../functions/mv.h ../functions/nicedit.h ../functions/node.h
mounts.o: ../functions/passwd.h ../functions/priv.h ../functions/pw.h
mounts.o: ../functions/reload.h ../functions/rm.h ../functions/rmuser.h
mounts.o: ../functions/sort.h ../functions/specialdefault.h
mounts.o: ../functions/stat.h ../functions/subject.h ../functions/template.h
mounts.o: ../functions/env.h ../functions/imgcrop.h ../functions/last.h
mounts.o: ../functions/login.h ../functions/logout.h ../functions/ln.h
mounts.o: ../functions/ls.h ../functions/man.h ../functions/meta.h
mounts.o: ../functions/mkdir.h ../functions/mv.h ../functions/nicedit.h
mounts.o: ../functions/node.h ../functions/passwd.h ../functions/priv.h
mounts.o: ../functions/pw.h ../functions/reload.h ../functions/rm.h
mounts.o: ../functions/rmuser.h ../functions/sort.h
mounts.o: ../functions/specialdefault.h ../functions/stat.h
mounts.o: ../functions/subject.h ../functions/template.h
mounts.o: ../functions/tinymce.h ../functions/uname.h ../functions/upload.h
mounts.o: ../functions/uptime.h ../functions/who.h ../functions/vim.h
mounts.o: ../core/htmlfilter.h ../templates/templates.h
@ -482,14 +483,14 @@ plugin.o: ../functions/adduser.h ../functions/cat.h ../functions/chmod.h
plugin.o: ../functions/privchanger.h ../functions/chown.h
plugin.o: ../functions/ckeditor.h ../functions/cp.h ../functions/default.h
plugin.o: ../functions/download.h ../functions/emacs.h ../functions/env.h
plugin.o: ../functions/last.h ../functions/login.h ../functions/logout.h
plugin.o: ../functions/ln.h ../functions/ls.h ../functions/man.h
plugin.o: ../functions/meta.h ../functions/mkdir.h ../functions/mv.h
plugin.o: ../functions/nicedit.h ../functions/node.h ../functions/passwd.h
plugin.o: ../functions/priv.h ../functions/pw.h ../functions/reload.h
plugin.o: ../functions/rm.h ../functions/rmuser.h ../functions/sort.h
plugin.o: ../functions/specialdefault.h ../functions/stat.h
plugin.o: ../functions/subject.h ../functions/template.h
plugin.o: ../functions/imgcrop.h ../functions/last.h ../functions/login.h
plugin.o: ../functions/logout.h ../functions/ln.h ../functions/ls.h
plugin.o: ../functions/man.h ../functions/meta.h ../functions/mkdir.h
plugin.o: ../functions/mv.h ../functions/nicedit.h ../functions/node.h
plugin.o: ../functions/passwd.h ../functions/priv.h ../functions/pw.h
plugin.o: ../functions/reload.h ../functions/rm.h ../functions/rmuser.h
plugin.o: ../functions/sort.h ../functions/specialdefault.h
plugin.o: ../functions/stat.h ../functions/subject.h ../functions/template.h
plugin.o: ../functions/tinymce.h ../functions/uname.h ../functions/upload.h
plugin.o: ../functions/uptime.h ../functions/who.h ../functions/vim.h
plugin.o: ../core/htmlfilter.h ../templates/templates.h
@ -532,22 +533,22 @@ plugindata.o: ../functions/adduser.h ../functions/cat.h ../functions/chmod.h
plugindata.o: ../functions/privchanger.h ../functions/chown.h
plugindata.o: ../functions/ckeditor.h ../functions/cp.h
plugindata.o: ../functions/default.h ../functions/download.h
plugindata.o: ../functions/emacs.h ../functions/env.h ../functions/last.h
plugindata.o: ../functions/login.h ../functions/logout.h ../functions/ln.h
plugindata.o: ../functions/ls.h ../functions/man.h ../functions/meta.h
plugindata.o: ../functions/mkdir.h ../functions/mv.h ../functions/nicedit.h
plugindata.o: ../functions/node.h ../functions/passwd.h ../functions/priv.h
plugindata.o: ../functions/pw.h ../functions/reload.h ../functions/rm.h
plugindata.o: ../functions/rmuser.h ../functions/sort.h
plugindata.o: ../functions/specialdefault.h ../functions/stat.h
plugindata.o: ../functions/subject.h ../functions/template.h
plugindata.o: ../functions/tinymce.h ../functions/uname.h
plugindata.o: ../functions/upload.h ../functions/uptime.h ../functions/who.h
plugindata.o: ../functions/vim.h ../core/htmlfilter.h
plugindata.o: ../templates/templates.h ../templates/patterncacher.h
plugindata.o: ../templates/indexpatterns.h ../templates/patterns.h
plugindata.o: ../templates/changepatterns.h ../templates/htmltextstream.h
plugindata.o: ../core/sessionmanager.h
plugindata.o: ../functions/emacs.h ../functions/env.h ../functions/imgcrop.h
plugindata.o: ../functions/last.h ../functions/login.h ../functions/logout.h
plugindata.o: ../functions/ln.h ../functions/ls.h ../functions/man.h
plugindata.o: ../functions/meta.h ../functions/mkdir.h ../functions/mv.h
plugindata.o: ../functions/nicedit.h ../functions/node.h
plugindata.o: ../functions/passwd.h ../functions/priv.h ../functions/pw.h
plugindata.o: ../functions/reload.h ../functions/rm.h ../functions/rmuser.h
plugindata.o: ../functions/sort.h ../functions/specialdefault.h
plugindata.o: ../functions/stat.h ../functions/subject.h
plugindata.o: ../functions/template.h ../functions/tinymce.h
plugindata.o: ../functions/uname.h ../functions/upload.h
plugindata.o: ../functions/uptime.h ../functions/who.h ../functions/vim.h
plugindata.o: ../core/htmlfilter.h ../templates/templates.h
plugindata.o: ../templates/patterncacher.h ../templates/indexpatterns.h
plugindata.o: ../templates/patterns.h ../templates/changepatterns.h
plugindata.o: ../templates/htmltextstream.h ../core/sessionmanager.h
postmultiparser.o: postmultiparser.h error.h requesttypes.h
postmultiparser.o: ../../pikotools/textstream/textstream.h
postmultiparser.o: ../../pikotools/space/space.h ../../pikotools/date/date.h
@ -610,14 +611,14 @@ request.o: ../functions/adduser.h ../functions/cat.h ../functions/chmod.h
request.o: ../functions/privchanger.h ../functions/chown.h
request.o: ../functions/ckeditor.h ../functions/cp.h ../functions/default.h
request.o: ../functions/download.h ../functions/emacs.h ../functions/env.h
request.o: ../functions/last.h ../functions/login.h ../functions/logout.h
request.o: ../functions/ln.h ../functions/ls.h ../functions/man.h
request.o: ../functions/meta.h ../functions/mkdir.h ../functions/mv.h
request.o: ../functions/nicedit.h ../functions/node.h ../functions/passwd.h
request.o: ../functions/priv.h ../functions/pw.h ../functions/reload.h
request.o: ../functions/rm.h ../functions/rmuser.h ../functions/sort.h
request.o: ../functions/specialdefault.h ../functions/stat.h
request.o: ../functions/subject.h ../functions/template.h
request.o: ../functions/imgcrop.h ../functions/last.h ../functions/login.h
request.o: ../functions/logout.h ../functions/ln.h ../functions/ls.h
request.o: ../functions/man.h ../functions/meta.h ../functions/mkdir.h
request.o: ../functions/mv.h ../functions/nicedit.h ../functions/node.h
request.o: ../functions/passwd.h ../functions/priv.h ../functions/pw.h
request.o: ../functions/reload.h ../functions/rm.h ../functions/rmuser.h
request.o: ../functions/sort.h ../functions/specialdefault.h
request.o: ../functions/stat.h ../functions/subject.h ../functions/template.h
request.o: ../functions/tinymce.h ../functions/uname.h ../functions/upload.h
request.o: ../functions/uptime.h ../functions/who.h ../functions/vim.h
request.o: ../core/htmlfilter.h ../templates/templates.h
@ -702,7 +703,8 @@ sessionmanager.o: ../functions/chmod.h ../functions/privchanger.h
sessionmanager.o: ../functions/chown.h ../functions/ckeditor.h
sessionmanager.o: ../functions/cp.h ../functions/default.h
sessionmanager.o: ../functions/download.h ../functions/emacs.h
sessionmanager.o: ../functions/env.h ../functions/last.h ../functions/login.h
sessionmanager.o: ../functions/env.h ../functions/imgcrop.h
sessionmanager.o: ../functions/last.h ../functions/login.h
sessionmanager.o: ../functions/logout.h ../functions/ln.h ../functions/ls.h
sessionmanager.o: ../functions/man.h ../functions/meta.h ../functions/mkdir.h
sessionmanager.o: ../functions/mv.h ../functions/nicedit.h
@ -784,14 +786,15 @@ system.o: ../functions/functionparser.h ../functions/adduser.h
system.o: ../functions/cat.h ../functions/chmod.h ../functions/privchanger.h
system.o: ../functions/chown.h ../functions/ckeditor.h ../functions/cp.h
system.o: ../functions/default.h ../functions/download.h ../functions/emacs.h
system.o: ../functions/env.h ../functions/last.h ../functions/login.h
system.o: ../functions/logout.h ../functions/ln.h ../functions/ls.h
system.o: ../functions/man.h ../functions/meta.h ../functions/mkdir.h
system.o: ../functions/mv.h ../functions/nicedit.h ../functions/node.h
system.o: ../functions/passwd.h ../functions/priv.h ../functions/pw.h
system.o: ../functions/reload.h ../functions/rm.h ../functions/rmuser.h
system.o: ../functions/sort.h ../functions/specialdefault.h
system.o: ../functions/stat.h ../functions/subject.h ../functions/template.h
system.o: ../functions/env.h ../functions/imgcrop.h ../functions/last.h
system.o: ../functions/login.h ../functions/logout.h ../functions/ln.h
system.o: ../functions/ls.h ../functions/man.h ../functions/meta.h
system.o: ../functions/mkdir.h ../functions/mv.h ../functions/nicedit.h
system.o: ../functions/node.h ../functions/passwd.h ../functions/priv.h
system.o: ../functions/pw.h ../functions/reload.h ../functions/rm.h
system.o: ../functions/rmuser.h ../functions/sort.h
system.o: ../functions/specialdefault.h ../functions/stat.h
system.o: ../functions/subject.h ../functions/template.h
system.o: ../functions/tinymce.h ../functions/uname.h ../functions/upload.h
system.o: ../functions/uptime.h ../functions/who.h ../functions/vim.h
system.o: plugin.h pluginmsg.h sessionmanager.h sessioncontainer.h
@ -867,14 +870,14 @@ users.o: ../functions/adduser.h ../functions/cat.h ../functions/chmod.h
users.o: ../functions/privchanger.h ../functions/chown.h
users.o: ../functions/ckeditor.h ../functions/cp.h ../functions/default.h
users.o: ../functions/download.h ../functions/emacs.h ../functions/env.h
users.o: ../functions/last.h ../functions/login.h ../functions/logout.h
users.o: ../functions/ln.h ../functions/ls.h ../functions/man.h
users.o: ../functions/meta.h ../functions/mkdir.h ../functions/mv.h
users.o: ../functions/nicedit.h ../functions/node.h ../functions/passwd.h
users.o: ../functions/priv.h ../functions/pw.h ../functions/reload.h
users.o: ../functions/rm.h ../functions/rmuser.h ../functions/sort.h
users.o: ../functions/specialdefault.h ../functions/stat.h
users.o: ../functions/subject.h ../functions/template.h
users.o: ../functions/imgcrop.h ../functions/last.h ../functions/login.h
users.o: ../functions/logout.h ../functions/ln.h ../functions/ls.h
users.o: ../functions/man.h ../functions/meta.h ../functions/mkdir.h
users.o: ../functions/mv.h ../functions/nicedit.h ../functions/node.h
users.o: ../functions/passwd.h ../functions/priv.h ../functions/pw.h
users.o: ../functions/reload.h ../functions/rm.h ../functions/rmuser.h
users.o: ../functions/sort.h ../functions/specialdefault.h
users.o: ../functions/stat.h ../functions/subject.h ../functions/template.h
users.o: ../functions/tinymce.h ../functions/uname.h ../functions/upload.h
users.o: ../functions/uptime.h ../functions/who.h ../functions/vim.h
users.o: ../core/htmlfilter.h ../templates/templates.h

@ -2,7 +2,7 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2010-2012, Tomasz Sowa
* Copyright (c) 2010-2013, Tomasz Sowa
* All rights reserved.
*
*/
@ -13,6 +13,7 @@
#include "log.h"
#include "system.h"
#include "plugin.h"
#include "lock.h"
@ -35,15 +36,91 @@ void Image::SetSystem(System * psystem)
}
// first thread (objects locked)
Image::Scale Image::GetImageScale(long dir_id)
{
Scale scale;
Mount * m = system->mounts.CalcMount(dir_id);
scale.cx = config->image_cx;
scale.cy = config->image_cy;
scale.aspect_mode = config->image_mode;
scale.quality = config->image_quality;
// reading width and height from the mount point (if exists)
int index = system->mounts.MountParImageSize();
if( m && m->param[index].defined && m->param[index].arg.size() == 2 )
{
scale.cx = Tol(m->param[index].arg[0]);
scale.cy = Tol(m->param[index].arg[1]);
}
// reading image mode from the mount point (if exists)
index = system->mounts.MountParImageMode();
if( m && m->param[index].defined && m->param[index].arg.size() == 1 )
scale.aspect_mode = Toi(m->param[index].arg[0]);
// reading image quality from the mount point (if exists)
index = system->mounts.MountParImageQuality();
if( m && m->param[index].defined && m->param[index].arg.size() == 1 )
scale.quality = Toi(m->param[index].arg[0]);
return scale;
}
// first thread (objects locked)
Image::Scale Image::GetThumbScale(long dir_id)
{
Scale scale;
Mount * m = system->mounts.CalcMount(dir_id);
scale.cx = config->thumb_cx;
scale.cy = config->thumb_cy;
scale.aspect_mode = config->thumb_mode;
scale.quality = config->thumb_quality;
// reading width and height from the mount point (if exists)
int index = system->mounts.MountParThumbSize();
if( m && m->param[index].defined && m->param[index].arg.size() == 2 )
{
scale.cx = Tol(m->param[index].arg[0]);
scale.cy = Tol(m->param[index].arg[1]);
}
// reading thumb mode from the mount point (if exists)
index = system->mounts.MountParThumbMode();
if( m && m->param[index].defined && m->param[index].arg.size() == 1 )
scale.aspect_mode = Toi(m->param[index].arg[0]);
// reading image quality from the mount point (if exists)
index = system->mounts.MountParThumbQuality();
if( m && m->param[index].defined && m->param[index].arg.size() == 1 )
scale.quality = Toi(m->param[index].arg[0]);
return scale;
}
// first thread (objects locked)
void Image::Resize(const Item & item, size_t cx, size_t cy, int aspect_mode, int quality)
void Image::Resize(long file_id, size_t cx, size_t cy, int aspect_mode, int quality)
{
item_temp.type = WINIX_IMAGE_TYPE_RESIZE;
item_temp.file = item;
item_temp.cx = cx;
item_temp.cy = cy;
item_temp.aspect_mode = aspect_mode;
item_temp.quality = quality;
item_temp.type = WINIX_IMAGE_TYPE_RESIZE;
item_temp.file_id = file_id;
item_temp.cx = cx;
item_temp.cy = cy;
item_temp.aspect_mode = aspect_mode;
item_temp.quality = quality;
CheckParam(item_temp);
image_tab.insert(image_tab.end(), item_temp);
@ -51,15 +128,16 @@ void Image::Resize(const Item & item, size_t cx, size_t cy, int aspect_mode, int
}
// first thread (objects locked)
void Image::CreateThumb(const Item & item, size_t cx, size_t cy, int aspect_mode, int quality)
void Image::CreateThumb(long file_id, size_t thumb_cx, size_t thumb_cy, int aspect_mode, int quality)
{
item_temp.type = WINIX_IMAGE_TYPE_CREATE_THUMB;
item_temp.file = item;
item_temp.cx = cx;
item_temp.cy = cy;
item_temp.aspect_mode = aspect_mode;
item_temp.quality = quality;
item_temp.type = WINIX_IMAGE_TYPE_CREATE_THUMB;
item_temp.file_id = file_id;
item_temp.thumb_cx = thumb_cx;
item_temp.thumb_cy = thumb_cy;
item_temp.aspect_mode = aspect_mode;
item_temp.quality = quality;
CheckParam(item_temp);
image_tab.insert(image_tab.end(), item_temp);
@ -68,31 +146,75 @@ void Image::CreateThumb(const Item & item, size_t cx, size_t cy, int aspect_mode
void Image::CheckParam(ImageItem & item)
// first thread (objects locked)
void Image::Crop(long file_id, size_t xoffset, size_t yoffset, size_t cx, size_t cy, int quality)
{
item_temp.type = WINIX_IMAGE_TYPE_CROP;
item_temp.file_id = file_id;
item_temp.xoffset = xoffset;
item_temp.yoffset = yoffset;
item_temp.cx = cx;
item_temp.cy = cy;
item_temp.quality = quality;
CheckParam(item_temp);
image_tab.insert(image_tab.end(), item_temp);
WakeUpThread();
}
// first thread (objects locked)
void Image::CropThumb(long file_id, size_t xoffset, size_t yoffset, size_t cx, size_t cy, int quality)
{
if( item.aspect_mode < 1 )
item.aspect_mode = 1;
item_temp.type = WINIX_IMAGE_TYPE_CROP_THUMB;
item_temp.file_id = file_id;
item_temp.xoffset = xoffset;
item_temp.yoffset = yoffset;
item_temp.cx = cx;
item_temp.cy = cy;
item_temp.quality = quality;
CheckParam(item_temp);
image_tab.insert(image_tab.end(), item_temp);
WakeUpThread();
}
if( item.aspect_mode > 7 )
item.aspect_mode = 7;
if( item.quality < 0 )
item.quality = 0;
if( item.quality > 100 )
item.quality = 100;
// first thread (objects locked)
void Image::CropNewThumb(long file_id, size_t xoffset, size_t yoffset, size_t cx, size_t cy,
size_t thumb_cx, size_t thumb_cy, int aspect_mode, int quality)
{
item_temp.type = WINIX_IMAGE_TYPE_CREATE_CROP_NEW_THUMB;
item_temp.file_id = file_id;
item_temp.xoffset = xoffset;
item_temp.yoffset = yoffset;
item_temp.cx = cx;
item_temp.cy = cy;
item_temp.thumb_cx = thumb_cx;
item_temp.thumb_cy = thumb_cy;
item_temp.aspect_mode = aspect_mode;
item_temp.quality = quality;
CheckParam(item_temp);
image_tab.insert(image_tab.end(), item_temp);
WakeUpThread();
}
if( item_temp.cx < 5 )
item_temp.cx = 5;
if( item_temp.cy < 5 )
item_temp.cy = 5;
if( item_temp.cx > 10000 )
item_temp.cx = 10000;
if( item_temp.cy > 10000 )
item_temp.cy = 10000;
void Image::CheckParam(ImageItem & item)
{
SetMinMax(item.aspect_mode, 1, 7);
SetMinMax(item.quality, 0, 100);
SetMinMax(item.cx, 1, 30000);
SetMinMax(item.cy, 1, 30000);
SetMinMax(item.thumb_cx, 1, 30000);
SetMinMax(item.thumb_cy, 1, 30000);
SetMinMax(item.xoffset, 0, 30000);
SetMinMax(item.yoffset, 0, 30000);
}
@ -117,7 +239,7 @@ bool end;
do
{
Lock();
class Lock lock_object(synchro);
if( i != image_tab.end() )
{
@ -130,7 +252,7 @@ bool end;
end = true;
}
Unlock();
lock_object.Unlock();
if( !end )
CreateImage();
@ -163,7 +285,8 @@ void Image::EscapePath(const std::string & path, TextStream<std::string> & out,
if( path[i] == '"' )
out << '\\';
out << path[i];
if( path[i] != 0 )
out << path[i];
}
out << '\"';
@ -184,37 +307,37 @@ widthxheight! Width and height emphatically given, original aspect ratio ignor
widthxheight> Change as per widthxheight but only if an image dimension exceeds a specified dimension.
widthxheight< Change dimensions only if both image dimensions exceed specified dimensions.
*/
void Image::SelectAspect()
void Image::SelectAspect(size_t cx, size_t cy)
{
switch( item_work.aspect_mode )
{
case WINIX_IMAGE_MODE_1:
command << item_work.cx;
command << cx;
break;
case WINIX_IMAGE_MODE_3:
command << item_work.cx << "x" << item_work.cy;
command << cx << "x" << cy;
break;
case WINIX_IMAGE_MODE_4:
command << '"' << item_work.cx << "x" << item_work.cy << "^\"";
command << '"' << cx << "x" << cy << "^\"";
break;
case WINIX_IMAGE_MODE_5:
command << '"' << item_work.cx << "x" << item_work.cy << "!\"";
command << '"' << cx << "x" << cy << "!\"";
break;
case WINIX_IMAGE_MODE_6:
command << '"' << item_work.cx << "x" << item_work.cy << ">\"";
command << '"' << cx << "x" << cy << ">\"";
break;
case WINIX_IMAGE_MODE_7:
command << '"' << item_work.cx << "x" << item_work.cy << "<\"";
command << '"' << cx << "x" << cy << "<\"";
break;
case WINIX_IMAGE_MODE_2:
default:
command << "x" << item_work.cy;
command << "x" << cy;
break;
}
}
@ -224,7 +347,17 @@ void Image::SelectAspect()
// second thread (objects locked)
bool Image::CreateInputFileName()
{
if( system->MakeFilePath(item_work.file, src_path) )
bool thumb = (item_work.type == WINIX_IMAGE_TYPE_CROP_THUMB);
if( thumb && !file_work.has_thumb )
{
log << log1 << "Image: file id: " << file_work.id << ", url: " << file_work.url
<< " doesn't have a thumbnail yet (skipping)" << logend;
return false;
}
if( system->MakeFilePath(file_work, src_path, thumb) )
{
PT::WideToUTF8(src_path, input_file_name);
return true;
@ -237,6 +370,7 @@ bool Image::CreateInputFileName()
}
// second thread (objects locked)
void Image::CreateTmpFileName()
{
@ -250,26 +384,17 @@ void Image::CreateTmpFileName()
// second thread (objects are not locked)
bool Image::CreateCommand()
{
Lock();
class Lock lock_object(synchro);
iq.SetAll(true, false);
iq.WhereId(item_work.file.id);
// !! skoro teraz i tak wczytujemy caly obiekt
// to teraz w kolejce wystarczy zapamietywac tylko samo item.id (a nie caly obiekt item)
iq.WhereId(item_work.file_id);
// the file could have been changed especially when there is a long queue of files
if( db->GetItem(item_work.file, iq) != WINIX_ERR_OK )
{
Unlock();
if( db->GetItem(file_work, iq) != WINIX_ERR_OK )
return false;
}
if( !CreateInputFileName() )
{
Unlock();
return false;
}
command.Clear();
Add(config->convert_cmd, command);
@ -279,11 +404,38 @@ bool Image::CreateCommand()
command << " -quiet -quality " << item_work.quality;
if( item_work.type == WINIX_IMAGE_TYPE_RESIZE )
{
command << " -resize ";
SelectAspect(item_work.cx, item_work.cy);
}
else
if( item_work.type == WINIX_IMAGE_TYPE_CREATE_THUMB )
{
command << " -strip -thumbnail ";
SelectAspect(item_work.thumb_cx, item_work.thumb_cy);
}
else
if( item_work.type == WINIX_IMAGE_TYPE_CROP )
{
command << " -crop " << item_work.cx << "x" << item_work.cy
<< "+" << item_work.xoffset << "+" << item_work.yoffset << " +repage ";
}
else
if( item_work.type == WINIX_IMAGE_TYPE_CROP_THUMB )
{
command << " -strip -crop " << item_work.cx << "x" << item_work.cy
<< "+" << item_work.xoffset << "+" << item_work.yoffset
<< " +repage ";
}
else
if( item_work.type == WINIX_IMAGE_TYPE_CREATE_CROP_NEW_THUMB )
{
command << " -strip -crop " << item_work.cx << "x" << item_work.cy
<< "+" << item_work.xoffset << "+" << item_work.yoffset
<< " +repage -thumbnail ";
SelectAspect(item_work.thumb_cx, item_work.thumb_cy);
}
SelectAspect();
CreateTmpFileName();
command << " ";
@ -291,7 +443,6 @@ bool Image::CreateCommand()
log << log4 << "Image: running: " << command.Str() << logend;
Unlock();
return true;
}
@ -299,43 +450,77 @@ return true;
// second thread (objects are locked)
void Image::ImageSavedCorrectly()
{
if( item_work.type == WINIX_IMAGE_TYPE_CREATE_THUMB )
{
if( !file_work.has_thumb )
{
file_work.has_thumb = true;
db->EditHasThumbById(true, file_work.id);
}
log << log3 << "Image: generated a thumbnail: " << dst_path << logend;
plugin.Call((Session*)0, WINIX_CREATED_THUMB, &file_work);
}
else
if( item_work.type == WINIX_IMAGE_TYPE_RESIZE )
{
log << log3 << "Image: image resized: " << dst_path << logend;
plugin.Call((Session*)0, WINIX_IMAGE_RESIZED, &file_work);
}
else
if( item_work.type == WINIX_IMAGE_TYPE_CROP )
{
log << log3 << "Image: image cropped: " << dst_path << logend;
// !! IMPROVE ME add a correct message
//plugin.Call((Session*)0, WINIX_IMAGE_RESIZED, &file_work);
}
else
if( item_work.type == WINIX_IMAGE_TYPE_CROP_THUMB )
{
log << log3 << "Image: image thumbnail cropped: " << dst_path << logend;
// !! IMPROVE ME add a correct message
//plugin.Call((Session*)0, WINIX_IMAGE_RESIZED, &file_work);
}
else
if( item_work.type == WINIX_IMAGE_TYPE_CREATE_CROP_NEW_THUMB )
{
log << log3 << "Image: a new thumbnail from an original image was cropped: " << dst_path << logend;
// !! IMPROVE ME add a correct message
//plugin.Call((Session*)0, WINIX_IMAGE_RESIZED, &file_work);
}
}
// second thread (objects are not locked)
void Image::SaveImage()
{
bool moved = false;
Lock();
class Lock lock_object(synchro);
// the file could have been changed especially when creating the image lasted too long
iq.SetAll(true, false);
iq.WhereId(item_work.file.id);
iq.WhereId(item_work.file_id);
if( db->GetItem(item_work.file, iq) == WINIX_ERR_OK )
if( db->GetItem(file_work, iq) == WINIX_ERR_OK )
{
bool thumb = (item_work.type == WINIX_IMAGE_TYPE_CREATE_THUMB);
bool thumb = (item_work.type == WINIX_IMAGE_TYPE_CREATE_THUMB ||
item_work.type == WINIX_IMAGE_TYPE_CROP_THUMB ||
item_work.type == WINIX_IMAGE_TYPE_CREATE_CROP_NEW_THUMB );
if( system->MakeFilePath(item_work.file, dst_path, thumb, true, config->upload_dirs_chmod) )
if( system->MakeFilePath(file_work, dst_path, thumb, true, config->upload_dirs_chmod) )
{
if( RenameFile(stream_tmp_path.Str(), dst_path) )
{
if( thumb )
{
item_work.file.has_thumb = true;
db->EditHasThumbById(true, item_work.file.id);
log << log3 << "Image: generated a thumbnail: " << dst_path << logend;
plugin.Call((Session*)0, WINIX_CREATED_THUMB, &item_work.file);
}
else
{
log << log3 << "Image: image resized: " << dst_path << logend;
plugin.Call((Session*)0, WINIX_IMAGE_RESIZED, &item_work.file);
}
moved = true;
ImageSavedCorrectly();
}
else
{
log << log1 << "Image: cannot move a temporary file: " << stream_tmp_path.Str() << ", to: " << dst_path << logend;
log << log1 << "Image: cannot move a temporary file: " << stream_tmp_path.Str()
<< ", to: " << dst_path << logend;
::RemoveFile(stream_tmp_path.Str());
}
}
else
@ -343,11 +528,6 @@ bool moved = false;
log << log1 << "Image: cannot create a destination path" << logend;
}
}
if( !moved )
::RemoveFile(stream_tmp_path.Str());
Unlock();
}
@ -355,21 +535,20 @@ bool moved = false;
// second thread (objects are not locked)
void Image::CreateImage()
{
if( !CreateCommand() )
return;
int res = std::system(command.CStr());
if( res == 0 )
if( CreateCommand() )
{
SaveImage();
}
else
{
Lock();
log << log3 << "Image: some problems with creating an image"
<< ", 'convert' process returned: " << res << logend;
Unlock();
int res = std::system(command.CStr());
if( res == 0 )
{
SaveImage();
}
else
{
class Lock lock_object(synchro);
log << log3 << "Image: some problems with creating an image"
<< ", 'convert' process returned: " << res << logend;
}
}
}

@ -2,7 +2,7 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2010-2011, Tomasz Sowa
* Copyright (c) 2010-2013, Tomasz Sowa
* All rights reserved.
*
*/
@ -22,7 +22,7 @@
class System;
// aspect modes:
// Width given, height automagically selected to preserve aspect ratio.
#define WINIX_IMAGE_MODE_1 1
@ -45,25 +45,74 @@ class System;
#define WINIX_IMAGE_MODE_7 7
// resizing
#define WINIX_IMAGE_TYPE_RESIZE 1
// generating a thumbnail
#define WINIX_IMAGE_TYPE_CREATE_THUMB 2
// cropping an image
#define WINIX_IMAGE_TYPE_CROP 3
// cropping an thumbnail
#define WINIX_IMAGE_TYPE_CROP_THUMB 4
// creating by cropping a new thumbnail (from an original image)
#define WINIX_IMAGE_TYPE_CREATE_CROP_NEW_THUMB 5
/*
*/
class Image : public BaseThread
{
public:
struct Scale
{
size_t cx;
size_t cy;
int aspect_mode;
int quality;
Scale()
{
cx = cy = 1;
aspect_mode = 2;
quality = 100;
};
};
void SetDb(Db * pdb);
void SetConfig(Config * pconfig);
void SetSystem(System * psystem);
void Resize(const Item & item, size_t cx, size_t cy, int aspect_mode, int quality);
void CreateThumb(const Item & item, size_t cx, size_t cy, int aspect_mode, int quality);
// returning scale info for a directory
Scale GetImageScale(long dir_id);
// returning scale info (for thumbnails) for a directory
Scale GetThumbScale(long dir_id);
void Resize(long file_id, size_t cx, size_t cy, int aspect_mode, int quality);
// creating a new thumbnail from an original image
void CreateThumb(long file_id, size_t thumb_cx, size_t thumb_cy, int aspect_mode, int quality);
// cropping an image (the thumbnail is not changed)
void Crop(long file_id, size_t xoffset, size_t yoffset, size_t cx, size_t cy, int quality);
// cropping an existing thumbnail
void CropThumb(long file_id, size_t xoffset, size_t yoffset, size_t cx, size_t cy, int quality);
// creating and cropping a new thumbnail (from an original image)
void CropNewThumb(long file_id, size_t xoffset, size_t yoffset, size_t cx, size_t cy,
size_t thumb_cx, size_t thumb_cy, int aspect_mode, int quality);
private:
@ -75,13 +124,29 @@ private:
struct ImageItem
{
int type; // WINIX_IMAGE_TYPE_*
Item file;
long file_id;
size_t cx;
size_t cy;
size_t xoffset; // xoffset and yoffset are used when cropping
size_t yoffset;
size_t thumb_cx;
size_t thumb_cy;
int aspect_mode;
int quality;
};
template<typename int_type>
void SetMinMax(int_type & var, int var_min, int var_max)
{
if( static_cast<int>(var) < var_min )
var = var_min;
if( static_cast<int>(var) > var_max )
var = var_max;
}
// queue of thumbnails to create
typedef std::list<ImageItem> ImageTab;
ImageTab image_tab;
@ -96,6 +161,7 @@ private:
std::string add_tempa;
std::string input_file_name;
std::string tmp_file_name;
Item file_work;
virtual bool SignalReceived();
virtual void Do();
@ -104,10 +170,12 @@ private:
void CreateTmpFileName();
void SaveImage();
void CreateImage();
void SelectAspect();
void SelectAspect(size_t cx, size_t cy);
void EscapePath(const std::string & path, TextStream<std::string> & out, bool clear_stream = true);
void CheckParam(ImageItem & item);
void Add(const std::wstring & in, TextStream<std::string> & out);
void ImageSavedCorrectly();
};

@ -2,7 +2,7 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2012, Tomasz Sowa
* Copyright (c) 2008-2013, Tomasz Sowa
* All rights reserved.
*
*/
@ -10,6 +10,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fstream>
#include <cstdlib>
#include "misc.h"
#include "log.h"
#include "templates/templates.h"
@ -77,6 +78,34 @@ long Tol(const wchar_t * str, int base)
double Tod(const std::string & str)
{
return strtod(str.c_str(), 0);
}
double Tod(const std::wstring & str)
{
return wcstold(str.c_str(), 0);
}
double Tod(const char * str)
{
return strtod(str, 0);
}
double Tod(const wchar_t * str)
{
return wcstold(str, 0);
}
const wchar_t * Toa(unsigned int value, int base)
{

@ -38,6 +38,11 @@ long Tol(const std::wstring & str, int base = 10);
long Tol(const char * str, int base = 10);
long Tol(const wchar_t * str, int base = 10);
double Tod(const std::string & str);
double Tod(const std::wstring & str);
double Tod(const char * str);
double Tod(const wchar_t * str);
// if the buffer is too small it will be terminated at the beginning (empty string)
// and the function returns false
@ -996,6 +1001,17 @@ size_t i1, i2;
template<typename IntType>
void SetMinMax(IntType & val, IntType min_val, IntType max_val)
{
if( val < min_val )
val = min_val;
if( val > max_val )
val = max_val;
}
#endif

@ -13,7 +13,7 @@
#define WINIX_VER_MAJOR 0
#define WINIX_VER_MINOR 5
#define WINIX_VER_REVISION 3
#define WINIX_VER_REVISION 4
#endif

File diff suppressed because it is too large Load Diff

@ -1 +1 @@
o = adduser.o cat.o chmod.o chown.o ckeditor.o cp.o default.o download.o emacs.o env.o functionbase.o functionparser.o functions.o ipban.o last.o ln.o locale.o login.o logout.o ls.o man.o meta.o mkdir.o mount.o mv.o nicedit.o node.o passwd.o priv.o privchanger.o pw.o reload.o rm.o rmuser.o run.o sort.o specialdefault.o stat.o subject.o template.o timezone.o tinymce.o uname.o upload.o uptime.o vim.o who.o
o = adduser.o cat.o chmod.o chown.o ckeditor.o cp.o default.o download.o emacs.o env.o functionbase.o functionparser.o functions.o imgcrop.o ipban.o last.o ln.o locale.o login.o logout.o ls.o man.o meta.o mkdir.o mount.o mv.o nicedit.o node.o passwd.o priv.o privchanger.o pw.o reload.o rm.o rmuser.o run.o sort.o specialdefault.o stat.o subject.o template.o timezone.o tinymce.o uname.o upload.o uptime.o vim.o who.o

@ -2,7 +2,7 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2010-2012, Tomasz Sowa
* Copyright (c) 2010-2013, Tomasz Sowa
* All rights reserved.
*
*/
@ -192,6 +192,7 @@ void Functions::CreateFunctions()
Add(fun_download);
Add(fun_emacs);
Add(fun_env);
Add(fun_imgcrop);
Add(fun_last);
Add(fun_locale);
Add(fun_login);

@ -2,7 +2,7 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2010-2012, Tomasz Sowa
* Copyright (c) 2010-2013, Tomasz Sowa
* All rights reserved.
*
*/
@ -23,6 +23,7 @@
#include "download.h"
#include "emacs.h"
#include "env.h"
#include "imgcrop.h"
#include "last.h"
#include "locale.h"
#include "login.h"
@ -77,6 +78,7 @@ public:
Fun::Download fun_download;
Fun::Emacs fun_emacs;
Fun::Env fun_env;
Fun::ImgCrop fun_imgcrop;
Fun::Last fun_last;
Fun::Locale fun_locale;
Fun::Login fun_login;

@ -0,0 +1,101 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2013, Tomasz Sowa
* All rights reserved.
*
*/
#include "imgcrop.h"
#include "functions.h"
namespace Fun
{
ImgCrop::ImgCrop()
{
fun.url = L"imgcrop";
}
bool ImgCrop::HasAccess()
{
if( cur->request->is_item )
return system->HasWriteAccess(cur->request->item);
return true;
}
void ImgCrop::GetDirContent()
{
iq.sel_content = false;
iq.WhereParentId(cur->request->dir_tab.back()->id);
db->GetItems(cur->request->item_tab, iq);
system->CheckWriteAccessToItems(cur->request->item_tab);
}
void ImgCrop::MakePost()
{
int xoffset = int(Tod(cur->request->PostVar(L"cropxtop")) + 0.5);
int yoffset = int(Tod(cur->request->PostVar(L"cropytop")) + 0.5);
int width = int(Tod(cur->request->PostVar(L"cropwidth")) + 0.5);
int height = int(Tod(cur->request->PostVar(L"cropheight")) + 0.5);
SetMinMax(xoffset, 0, 30000);
SetMinMax(yoffset, 0, 30000);
SetMinMax(width, 1, 30000);
SetMinMax(height, 1, 30000);
Item & item = cur->request->item;
if( cur->request->is_item && item.type == Item::file && item.file_type == WINIX_ITEM_FILETYPE_IMAGE )
{
if( system->HasWriteAccess(item) )
{
// !! IMPROVE ME add info about modification (Item::modify_time)
if( cur->request->IsParam(L"thumb") )
{
Image::Scale scale = system->image.GetThumbScale(item.parent_id);
system->image.CropThumb(item.id, xoffset, yoffset, width, height, scale.quality);
}
else
if( cur->request->IsParam(L"newthumb") )
{
Image::Scale scale = system->image.GetThumbScale(item.parent_id);
system->image.CropNewThumb(item.id, xoffset, yoffset, width, height, scale.cx, scale.cy,
scale.aspect_mode, scale.quality);
}
else
{
Image::Scale scale = system->image.GetImageScale(item.parent_id);
system->image.Crop(item.id, xoffset, yoffset, width, height, scale.quality);
}
// !! IMPROVE ME redirect me somewhere else
system->RedirectToLastItem();
}
else
{
cur->request->status = WINIX_ERR_PERMISSION_DENIED;
}
}
}
void ImgCrop::MakeGet()
{
if( !cur->request->is_item )
GetDirContent();
}
} // namespace

@ -0,0 +1,42 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2013, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_functions_imgcrop
#define headerfile_winix_functions_imgcrop
#include "functionbase.h"
namespace Fun
{
class ImgCrop : public FunctionBase
{
public:
ImgCrop();
bool HasAccess();
void MakeGet();
void MakePost();
private:
DbItemQuery iq;
void GetDirContent();
};
} // namespace
#endif

@ -2,7 +2,7 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2012, Tomasz Sowa
* Copyright (c) 2008-2013, Tomasz Sowa
* All rights reserved.
*
*/
@ -89,68 +89,16 @@ bool Upload::UploadSaveStaticFile(const Item & item, const std::wstring & tmp_fi
void Upload::ResizeImage(Item & item)
{
::Mount * m = system->mounts.CalcMount(item.parent_id);
size_t cx = config->image_cx;
size_t cy = config->image_cy;
int mode = config->image_mode;
int quality = config->image_quality;
// reading width and height from the mount point (if exists)
int index = system->mounts.MountParImageSize();
if( m && m->param[index].defined && m->param[index].arg.size() == 2 )
{
cx = Tol(m->param[index].arg[0]);
cy = Tol(m->param[index].arg[1]);
}
// reading image mode from the mount point (if exists)
index = system->mounts.MountParImageMode();
if( m && m->param[index].defined && m->param[index].arg.size() == 1 )
mode = Toi(m->param[index].arg[0]);
// reading image quality from the mount point (if exists)
index = system->mounts.MountParImageQuality();
if( m && m->param[index].defined && m->param[index].arg.size() == 1 )
quality = Toi(m->param[index].arg[0]);
system->image.Resize(item, cx, cy, mode, quality);
Image::Scale scale = system->image.GetImageScale(item.parent_id);
system->image.Resize(item.id, scale.cx, scale.cy, scale.aspect_mode, scale.quality);
}
void Upload::CreateThumb(Item & item)
{
::Mount * m = system->mounts.CalcMount(item.parent_id);
size_t cx = config->thumb_cx;