Please note the new address for this forum : forum.excito.org. The old address redirects here but I don't know for how long. Thanks !
New user's registration have been closed due to high spamming and low trafic on this forum. Please contact forum admins directly if you need an account. Thanks !

Can't install epeg0-bin (together with spgm-gallery)

Got problems with your B2 or B3? Share and get helped!
Post Reply
ahab
Posts: 35
Joined: 25 Aug 2008, 17:35

Can't install epeg0-bin (together with spgm-gallery)

Post by ahab »

I've installed spgm gallery but can't install the epeg0-bin package mentionen. I've tried with "apt-get install epeg0-bin" but it says it cannot find the package. I've also tried with just "install epeg0-bin" without any success. I've logged on using putty and then changed to "su".

What am I doing wrong? Please help me.

I've also registerad a question on the how-to but thought that maybe people doesn't look there that often. (http://forum.excito.net//viewtopic.php?t=781)
Henke
Posts: 1
Joined: 22 Jan 2009, 16:09

Problems to install epeg0-bin

Post by Henke »

Hi Did anyone find out how to solve this issue? I have also tried to log on the system with SSh and then be super user. I cant get the command
'apt-get install epeg0-bin' to work eighter. Can you please just give me short description on how to install this feature?

Thank a lot!
Ubi
Posts: 1549
Joined: 17 Jul 2007, 09:01

Post by Ubi »

I never liked epeg0-bin as it does not check for existing thumbnails before making new ones. Considering the cpu power of bubba this is not very wise.

I wrote my own script using python imaging. It makes symlinks from the picture dir into the webdir:

(first install the imaging lib)

Code: Select all

[root@korona:/tmp]$apt-get install python-imaging
This script only dives one dir deep. It is still rather rough, but does the trick. You can run it as a daily cronjob so it will update your images automagically. The benefit of the symlinks is that it makes the thumbnails when it adds the extra dir so the number of errors on the site is reduced

Code: Select all

#!/usr/bin/python
from PIL import Image
import glob
import os
import sys


PICTUREDIR = "/home/storage/pictures/2008"
TARGETDIR = "/home/web/spgm/gal/"
EXTENSIONLIST = [ "*.JPG","*.jpg","*.jpeg","*.JPEG"]
THUMBNAIL_PREFIX = "_thb_"
THUMBNAILSIZE = 128, 128
MAXPROCESS = 10000


#-------------------------------------------------------------
# Do not edit below this line
#-------------------------------------------------------------

if not os.access(TARGETDIR,os.W_OK) or not os.access(TARGETDIR,os.X_OK):
    print "The target dir is not writable by this user"

#create symlinks for each dir in the gallery target dir
FILELIST = glob.glob(PICTUREDIR+"/*")
for ITEM in FILELIST:
    #test if the item is really a folder
    if os.path.isdir(ITEM):
        DIRNAME = os.path.split(ITEM)[1]
        TARGETDIRNAME = TARGETDIR+'/'+DIRNAME
        #test if the dir does not het exist on the new position
        if not os.path.isdir(TARGETDIRNAME):
            print "make new link to dir " + TARGETDIRNAME
            os.symlink(ITEM,TARGETDIRNAME)

#OK cool, we made the dir stucture
# now make the thumbnails

#first create a list with all the files
FILELIST = []
for i in EXTENSIONLIST:
        FILELIST.extend(glob.glob(TARGETDIR + "/*/" + i))

print "Found",str(len(FILELIST)),"Files"

#print FILELIST
for IMAGE in FILELIST[:MAXPROCESS]:
    #define dir, filename, extension
    FDIR,FNAME_EXT = os.path.split(IMAGE)
    FNAME,FEXT = os.path.splitext(FNAME_EXT)

    #first check if the file is not a thumbnail
    if FNAME[:len(THUMBNAIL_PREFIX)]== THUMBNAIL_PREFIX:
        continue

    # guess what the thumbnail file must be named like
    THUMBNAILFILE = os.path.join(FDIR,THUMBNAIL_PREFIX + FNAME_EXT)
    #check if the thumbnail does not exist, and skip if it does
    if not os.path.exists(THUMBNAILFILE):
        #create a new thumbnail
        print "creating thumbnail for",IMAGE
        im = Image.open(IMAGE)
        im.thumbnail(THUMBNAILSIZE, Image.ANTIALIAS)
        im.save(THUMBNAILFILE, "JPEG")

hope this helps
Ubi
Post Reply