aboutsummaryrefslogtreecommitdiffstats
path: root/nikola/plugins/task/scale_images.py
diff options
context:
space:
mode:
authorLibravatarAgustin Henze <tin@sluc.org.ar>2015-08-26 07:57:04 -0300
committerLibravatarAgustin Henze <tin@sluc.org.ar>2015-08-26 07:57:04 -0300
commit8041475aab2b8efad7d2857027331bd626d26312 (patch)
tree3980e1763c067079a4cebb425d642ca9eac834bf /nikola/plugins/task/scale_images.py
parentb0b24795b24ee6809397fbbadf42f31f310a219f (diff)
Imported Upstream version 7.6.4
Diffstat (limited to 'nikola/plugins/task/scale_images.py')
-rw-r--r--nikola/plugins/task/scale_images.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/nikola/plugins/task/scale_images.py b/nikola/plugins/task/scale_images.py
index f97027e..22ed2ab 100644
--- a/nikola/plugins/task/scale_images.py
+++ b/nikola/plugins/task/scale_images.py
@@ -24,6 +24,8 @@
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+"""Resize images and create thumbnails for them."""
+
import os
from nikola.plugin_categories import Task
@@ -32,17 +34,18 @@ from nikola import utils
class ScaleImage(Task, ImageProcessor):
- """Copy static files into the output folder."""
+
+ """Resize images and create thumbnails for them."""
name = "scale_images"
def set_site(self, site):
- self.logger = utils.get_logger('scale_images', site.loghandlers)
+ """Set Nikola site."""
+ self.logger = utils.get_logger('scale_images', utils.STDERR_HANDLER)
return super(ScaleImage, self).set_site(site)
def process_tree(self, src, dst):
- """Processes all images in a src tree and put the (possibly) rescaled
- images in the dst folder."""
+ """Process all images in a src tree and put the (possibly) rescaled images in the dst folder."""
ignore = set(['.svn'])
base_len = len(src.split(os.sep))
for root, dirs, files in os.walk(src, followlinks=True):
@@ -68,12 +71,12 @@ class ScaleImage(Task, ImageProcessor):
}
def process_image(self, src, dst, thumb):
+ """Resize an image."""
self.resize_image(src, dst, self.kw['max_image_size'], False)
self.resize_image(src, thumb, self.kw['image_thumbnail_size'], False)
def gen_tasks(self):
"""Copy static files into the output folder."""
-
self.kw = {
'image_thumbnail_size': self.site.config['IMAGE_THUMBNAIL_SIZE'],
'max_image_size': self.site.config['MAX_IMAGE_SIZE'],