Attachment 'ImageZoom.py'

Download

   1 from MoinMoin.wikiutil import get_unicode, get_bool, get_int, get_float
   2 
   3 """
   4     Copyright (C) 2010 Andy D'Arcy Jewell
   5 
   6     This program is free software: you can redistribute it and/or modify
   7     it under the terms of the GNU General Public License as published by
   8     the Free Software Foundation, either version 3 of the License, or
   9     (at your option) any later version.
  10 
  11     This program is distributed in the hope that it will be useful,
  12     but WITHOUT ANY WARRANTY; without even the implied warranty of
  13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14     GNU General Public License for more details.
  15 
  16     You should have received a copy of the GNU General Public License
  17     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  18 
  19 """
  20 generates_headings = False
  21 
  22 def macro_ImageZoom(macro,image_url,width=None,height=None,label=None):
  23     """ ImageZoom("image_url",width=None,height=None,label=None) - Displays an image thumbnail which when clicked opens full-size in a new window. """
  24     # arguments passed in can be None or a unicode 
  25     if label == None:
  26         label = "Click image to view full size."
  27     if width == None:
  28         width = ""
  29     else:
  30         width = """ width="%s" """ % str(width)
  31     if height == None:
  32         height = ""
  33     else:
  34         height = """ height="%s" """ % str(height)
  35     return u'''<img src="%s" %s %s onclick="window.open('%s')" ><br><small><em>%s</em></small>''' % (image_url, width, height, image_url, label)

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2010-02-16 13:00:00, 1.5 KB) [[attachment:ImageZoom.py]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.