<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://mediawiki.geitenpad.rijkenmiel.nl/index.php?action=history&amp;feed=atom&amp;title=SFPG</id>
	<title>SFPG - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://mediawiki.geitenpad.rijkenmiel.nl/index.php?action=history&amp;feed=atom&amp;title=SFPG"/>
	<link rel="alternate" type="text/html" href="https://mediawiki.geitenpad.rijkenmiel.nl/index.php?title=SFPG&amp;action=history"/>
	<updated>2026-09-12T03:24:21Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>https://mediawiki.geitenpad.rijkenmiel.nl/index.php?title=SFPG&amp;diff=119&amp;oldid=prev</id>
		<title>Rijk: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.geitenpad.rijkenmiel.nl/index.php?title=SFPG&amp;diff=119&amp;oldid=prev"/>
		<updated>2025-01-05T14:34:04Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 14:34, 5 January 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Rijk</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.geitenpad.rijkenmiel.nl/index.php?title=SFPG&amp;diff=118&amp;oldid=prev</id>
		<title>Rijk: /* Olimex */</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.geitenpad.rijkenmiel.nl/index.php?title=SFPG&amp;diff=118&amp;oldid=prev"/>
		<updated>2014-12-29T14:56:49Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Olimex&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Olimex ==&lt;br /&gt;
&lt;br /&gt;
 root@a20-OLinuXino:~# aptitude install imagemagick&lt;br /&gt;
 root@a20-OLinuXino:~# aptitude install python-imaging&lt;br /&gt;
 root@a20-OLinuXino:~# touch /var/log/preCacheSFPG.log&lt;br /&gt;
&lt;br /&gt;
 root@a20-OLinuXino:~# vim /etc/crontab&lt;br /&gt;
&lt;br /&gt;
* Add line&lt;br /&gt;
 &lt;br /&gt;
 0     4 * * *   root /root/scripts/preCacheSFPG.py &amp;gt; /var/log/preCacheSFPG.log&lt;br /&gt;
&lt;br /&gt;
* Create script&lt;br /&gt;
&lt;br /&gt;
 root@a20-OLinuXino:~# vim /root/scripts/preCacheSFPG.py&lt;br /&gt;
&lt;br /&gt;
 #!/usr/bin/python&lt;br /&gt;
 &lt;br /&gt;
 import os&lt;br /&gt;
 import sys&lt;br /&gt;
 import Image&lt;br /&gt;
 import time&lt;br /&gt;
 import datetime &lt;br /&gt;
 &lt;br /&gt;
 preCachSize = 40000&lt;br /&gt;
 albumfiles = []&lt;br /&gt;
 result = []&lt;br /&gt;
 sfpg = &amp;#039;/var/www/html/sfpg/&amp;#039;&lt;br /&gt;
 cache = sfpg + &amp;#039;sfpg_data/&amp;#039;&lt;br /&gt;
 albums = &amp;#039;/home/rijk/Documents/Pictures/&amp;#039;&lt;br /&gt;
 info = cache + &amp;#039;info/&amp;#039;&lt;br /&gt;
 infofile = &amp;#039;.sfpg&amp;#039;&lt;br /&gt;
 thumb = cache + &amp;#039;thumb/&amp;#039;&lt;br /&gt;
 preview = cache + &amp;#039;preview/&amp;#039;&lt;br /&gt;
 thumb_size = 120&lt;br /&gt;
 preview_size = 800 &lt;br /&gt;
 &lt;br /&gt;
 def preCache(original, cachedFile, newSize):&lt;br /&gt;
        dirname = os.path.dirname(cachedFile)&lt;br /&gt;
        if not os.path.exists(dirname):&lt;br /&gt;
                os.makedirs(dirname)&lt;br /&gt;
        command = &amp;#039;convert -strip -auto-orient &amp;quot;&amp;#039; + original + &amp;#039;&amp;quot; -resize &amp;quot;%dx%d&amp;quot; &amp;quot;&amp;#039; + cachedFile + &amp;#039;&amp;quot;&amp;#039;&lt;br /&gt;
        command = command % (newSize, newSize)&lt;br /&gt;
        os.system(command)&lt;br /&gt;
        print &amp;#039;added: &amp;#039; + time.asctime() + &amp;#039; &amp;#039; + cachedFile&lt;br /&gt;
 &lt;br /&gt;
 def writeInfo(original, infoFile):&lt;br /&gt;
        dirname = os.path.dirname(infoFile)&lt;br /&gt;
        if not os.path.exists(dirname):&lt;br /&gt;
                os.makedirs(dirname)&lt;br /&gt;
        creationtime = getCreationTime(original)&lt;br /&gt;
        filesize = &amp;#039;%.2f&amp;#039;%(os.path.getsize(original)/(1024.0*1024))&lt;br /&gt;
        imagesize = Image.open(original).size&lt;br /&gt;
        file = open(infoFile, &amp;#039;w&amp;#039;)&lt;br /&gt;
        file.write(creationtime + &amp;#039;|&amp;#039; + filesize + &amp;#039; MB|%d|%d|&amp;#039;%imagesize)&lt;br /&gt;
        file.close()&lt;br /&gt;
 &lt;br /&gt;
 def getCreationTime(imagePath):&lt;br /&gt;
        creationtime = time.strftime(&amp;#039;%d-%m-%Y %H:%M:%S&amp;#039;, time.gmtime(os.path.getmtime(imagePath)))&lt;br /&gt;
        imageFile = Image.open(imagePath)&lt;br /&gt;
        if hasattr(imageFile, &amp;#039;_getexif&amp;#039;):&lt;br /&gt;
                exifdata = imageFile._getexif()&lt;br /&gt;
                if exifdata:&lt;br /&gt;
                        if 0x9003 in exifdata:&lt;br /&gt;
                                ctime = exifdata[0x9003].replace(&amp;#039;\x00&amp;#039;, &amp;#039;&amp;#039;)&lt;br /&gt;
                                if ctime == &amp;#039;0000:00:00 00:00:00&amp;#039;:&lt;br /&gt;
                                        return creationtime&lt;br /&gt;
                                else:   &lt;br /&gt;
                                        try:&lt;br /&gt;
                                                ctime = datetime.datetime.strptime(ctime, &amp;#039;%Y:%m:%d %H:%M:%S&amp;#039;)&lt;br /&gt;
                                                creationtime = time.strftime(&amp;#039;%d-%m-%Y %H:%M:%S&amp;#039;, ctime.timetuple())&lt;br /&gt;
                                        except: &lt;br /&gt;
                                                ctime = datetime.datetime.strptime(ctime[0:19], &amp;#039;%Y-%m-%d %H:%M:%S&amp;#039;)&lt;br /&gt;
                                                creationtime = time.strftime(&amp;#039;%d-%m-%Y %H:%M:%S&amp;#039;, ctime.timetuple())&lt;br /&gt;
        return creationtime&lt;br /&gt;
 &lt;br /&gt;
 # Add photo&amp;#039;s to the list if no preview file exists&lt;br /&gt;
 for root, subFolders, files in os.walk(albums, followlinks=True):&lt;br /&gt;
    for file in files:&lt;br /&gt;
                albumfile = os.path.join(root, file)&lt;br /&gt;
                if not os.path.exists(albumfile.replace(albums, preview, 1)):&lt;br /&gt;
                        albumfiles.append(albumfile)&lt;br /&gt;
 &lt;br /&gt;
 # Only precache jpg&lt;br /&gt;
 for albumfile in albumfiles:&lt;br /&gt;
        if (albumfile.endswith(&amp;#039;jpg&amp;#039;) or albumfile.endswith(&amp;#039;JPG&amp;#039;)):&lt;br /&gt;
                result.append(albumfile)&lt;br /&gt;
 &lt;br /&gt;
 # Just a few            &lt;br /&gt;
 for uncachedFile in result[0:preCachSize]:&lt;br /&gt;
        preCache(uncachedFile, uncachedFile.replace(albums, thumb, 1), thumb_size)&lt;br /&gt;
        preCache(uncachedFile, uncachedFile.replace(albums, preview, 1), preview_size)&lt;br /&gt;
        writeInfo(uncachedFile, uncachedFile.replace(albums, info, 1) + infofile)&lt;br /&gt;
 &lt;br /&gt;
 # Set owner of precaches to wwwrun              &lt;br /&gt;
 os.system(&amp;#039;chown -R www-data:www-data &amp;#039; + cache)&lt;br /&gt;
 &lt;br /&gt;
 # Remove old thumbs&lt;br /&gt;
 for root, subFolders, files in os.walk(thumb, followlinks=False):&lt;br /&gt;
    for file in files:&lt;br /&gt;
                thumbfile = os.path.join(root, file)&lt;br /&gt;
                if not os.path.exists(thumbfile.replace(thumb, albums, 1)):&lt;br /&gt;
                        print &amp;#039;remove &amp;#039; + thumbfile&lt;br /&gt;
                        os.remove(thumbfile)&lt;br /&gt;
 &lt;br /&gt;
 # Remove old previews&lt;br /&gt;
 for root, subFolders, files in os.walk(preview, followlinks=False):&lt;br /&gt;
    for file in files:&lt;br /&gt;
                previewfile = os.path.join(root, file)&lt;br /&gt;
                if not os.path.exists(previewfile.replace(preview, albums, 1)):&lt;br /&gt;
                        print &amp;#039;remove &amp;#039; + previewfile&lt;br /&gt;
                        os.remove(previewfile)&lt;br /&gt;
 &lt;br /&gt;
 # Remove old info&lt;br /&gt;
 for root, subFolders, files in os.walk(info, followlinks=False):&lt;br /&gt;
    for file in files:&lt;br /&gt;
                infofile = os.path.join(root, file)&lt;br /&gt;
                if not file == &amp;#039;_info.sfpg&amp;#039; and not os.path.exists(infofile.replace(info, albums, 1).replace(&amp;#039;.sfpg&amp;#039;, &amp;#039;&amp;#039;)):&lt;br /&gt;
                        print &amp;#039;remove &amp;#039; + infofile&lt;br /&gt;
                        os.remove(infofile)&lt;br /&gt;
&lt;br /&gt;
 root@a20-OLinuXino:~# chmod +x /root/scripts/preCacheSFPG.py&lt;br /&gt;
&lt;br /&gt;
== ProBook 6550b ==&lt;br /&gt;
&lt;br /&gt;
* Exactly the same as Olimex, only /var/www/html/sfpg instead of /var/www/sfpg&lt;br /&gt;
&lt;br /&gt;
 root@ppl:/var/www/html/sfpg# tree&lt;br /&gt;
 .&lt;br /&gt;
 ├── favicon.ico&lt;br /&gt;
 ├── index.php&lt;br /&gt;
 ├── index.php.beforeresizing&lt;br /&gt;
 ├── index.php.only.login&lt;br /&gt;
 ├── readme.txt&lt;br /&gt;
 └── sfpg_data&lt;/div&gt;</summary>
		<author><name>Rijk</name></author>
	</entry>
</feed>