ALT Linux Community general discussions
 help / color / mirror / Atom feed
From: Kolotov Alexandr <akmypost@mail.ru>
To: community@altlinux.ru
Subject: Re: [Comm] web album generator
Date: Thu, 17 Mar 2005 16:13:30 +0300
Message-ID: <4239827A.20905@mail.ru> (raw)
In-Reply-To: <1111053802.6294.7.camel@ibm.all-2.com>

[-- Attachment #1: Type: text/plain, Size: 969 bytes --]

> Может ктото из community уже сталкивался с подобной проблемой и может
> чтото посоветовать?
mum поищите на CITKIT.ru или sourceforge...
если есть навыки программирования на Shell/perl/python можете свое 
сваять за короткое время - я для этих целей пользовался инструментарием 
из ImageMagick, можно еще пользоваться отдельной тулзой exif...

См. вложение - формирует на стандартный вывод содержимое html-страницы

-- 
С уважением, Kolotov Alexandr aka mr. Эбола
              отвечать: akmypost@mail.ru
                   ICQ: 100349254

    ---------------------------------------
   |  Registered Linux user       # 236664 |
    ---------------------------------------

[-- Attachment #2: create_html.py --]
[-- Type: text/plain, Size: 2928 bytes --]

#!/usr/bin/python
# -*- coding: UTF-8 -*-

import os

# Где лежат исходные кратинки
path_to_images = "images/"
# Здесь будут лежать уменьшенные копии размером 800x600
path_to_small = "small/"
# Здесь будут лежать превьюшки 120x90
path_to_thumb = "thumb/"
# Здесь будет лежать мета-информация
path_to_exif = "exif/"

# Кол-во фоток в строке
images_in_line = 4

# Шапка html-страницы
def add_html_top():
    input = """<html>
<head>
    <META HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf8'>
    <title>Моя галерея</title>
</head>
<body>
    <center>
        <h3>Photo Album</h3>
        <table border="1" cellspacing="1">
"""
    return input

# Подвал html-страницы
def add_html_bottom():
    input = """        </table>
    </center>
</body>
</html>"""
    return input

# Одна строка таблицы
def add_html_line(ls):
    input = """            <tr align="center"><td>
                    <table border="0" cellpadding="10" cellspacing="0">
                        <tr align="center" valign="center">
"""
    for i in ls:
        one = "<td><a href=\""+i['image']+"\"><img src=\""+i['thumb']+"\" border='0' alt='' /></a></td>\n"
        input = input+one
    input = input + """                        </tr>
                        <tr align="center" valign="center">
"""
    for i in ls:
        one = "<td>\n"
        one = one+"<a href=\""+i['image']+"\"><font size='-2'>Full</font></a>&nbsp;\n"
        one = one+"<a href=\""+i['small']+"\"><font size='-2'>Small</font></a>&nbsp;\n"
        one = one+"<a href=\""+i['exif']+"\"><font size='-2'>EXIF</font></a>&nbsp;\n"
        one = one+"</td>\n"
        input = input+one
    input = input + """                        </tr>
                    </table>
            </td></tr>
"""
    return input

def main():
    files = os.listdir(path_to_images)
    print add_html_top()
    for i in xrange(0, len(files), images_in_line):
        l = []
        end_iter = i+images_in_line
        if end_iter > len(files):
            end_iter = len(files)
        for j in xrange(i, end_iter):
            d = {}
            d['image'] = path_to_images+files[j]
            d['small'] = path_to_small+files[j]
            d['thumb'] = path_to_thumb+files[j]
            d['exif'] = path_to_exif+files[j].split('.')[0]+".txt"
            l.append(d)
            cmd = "exif "+d['image']+" > "+d['exif']
            os.system(cmd)
            cmd = "convert -size 800x800 "+d['image']+" -resize 800x800 +profile \"*\" "+d['small']
            os.system(cmd)
            cmd = "convert -size 120x120 "+d['image']+" -resize 120x120 +profile \"*\" "+d['thumb']
            os.system(cmd)
        print add_html_line(l)
    print add_html_bottom()


if __name__ == '__main__':
    main()

  parent reply	other threads:[~2005-03-17 13:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-17 10:03 Alexander All2
2005-03-17  9:46 ` Igor
2005-03-17 10:38 ` Eugene Grudina
2005-03-17 13:13 ` Kolotov Alexandr [this message]
2005-03-17 13:49   ` Guest007

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4239827A.20905@mail.ru \
    --to=akmypost@mail.ru \
    --cc=community@altlinux.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux Community general discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 community community/ http://lore.altlinux.org/community \
		mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com
	public-inbox-index community

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.community


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git