Index: WAeUP_SRP/base/WAeUPTool.py
===================================================================
--- WAeUP_SRP/base/WAeUPTool.py	(revision 2334)
+++ WAeUP_SRP/base/WAeUPTool.py	(revision 2335)
@@ -693,7 +693,13 @@
     def showFsPicture(self,path):
         """return a picture from the filesystem"""
-        picture_path = "%s/import/%s" % (i_home,path)
+        picture_path = os.path.join(i_home,path)
+        response = self.REQUEST.RESPONSE
+        if os.path.exists(picture_path):
+            response.setHeader('Content-type','image/jpeg')
+            return open(picture_path).read()
+        picture_path = os.path.join(i_home,'import',path)
         if os.path.exists(picture_path):
             return open(picture_path).read()
+        
 
     ###)
Index: WAeUP_SRP/base/Widgets.py
===================================================================
--- WAeUP_SRP/base/Widgets.py	(revision 2334)
+++ WAeUP_SRP/base/Widgets.py	(revision 2335)
@@ -1740,4 +1740,255 @@
 ###)
 
+class FileImageWidget(CPSImageWidget): ###(
+    """Image widget with filesystem storage."""
+    meta_type = 'File Image Widget'
+    _properties = CPSImageWidget._properties +\
+    (
+     {'id': 'path', 'type': 'string', 'mode': 'w',
+      'label': 'Relative Path'},
+     {'id': 'id_field', 'type': 'string', 'mode': 'w',
+      'label': 'Field to build the id'},
+    )
+    path = "images"
+    storage_path = "%s/%s" % (i_home,path)
+    id_field = ""
+
+    def getImageInfo(self, datastructure): ###(
+        """Get the file info from the datastructure."""
+        #import pdb; pdb.set_trace()
+        widget_id = self.getWidgetId()
+        if  datastructure.has_key(widget_id):
+            fileupload = datastructure[widget_id]
+            dm = datastructure.getDataModel()
+            field_id = self.fields[0]
+            if self.id_field == "":
+                student_id = self.getStudentId()
+            else:
+                student_id = datastructure[self.id_field]
+            content_url = os.path.join(self.portal_url(),
+                                       "viewimage",
+                                       self.path,
+                                       student_id,
+                                       "%s_%s.jpg" % (self.getWidgetId(),student_id),
+                                       )
+            image_title = "%s_%s.jpg" % (widget_id,student_id)
+            current_filename = os.path.join(student_id,
+                                            image_title)
+            file_path = os.path.join(self.storage_path,
+                                     current_filename)
+        else:
+            file_path = "XXX"
+            image_title = ""
+        # read the file from the filesystem
+        if not os.path.exists(file_path):
+            height = -1
+            width = -1
+            empty_file = True
+            session_file = False
+            current_filename = ''
+            content_url = ''
+            size = 0
+            mimetype = ''
+            last_modified = ''
+            height = ''
+            width = ''
+        else:
+            image = open(file_path)
+            from OFS.Image import getImageInfo as getImageInfoOFS
+            image.seek(0)
+            data = image.read(2000)
+            size = len(data)
+            empty_file = size == 0
+            session_file = False
+            last_modified = ''
+            image.close()
+            mimetype, width, height = getImageInfoOFS(data)
+            registry = getToolByName(self, 'mimetypes_registry')
+            mimetype = (registry.lookupExtension(current_filename.lower()) or
+                        registry.lookupExtension('file.bin'))
+            if width < 0:
+                width = None
+            if height < 0:
+                height = None
+
+            if (self.allow_resize
+                and height is not None
+                and width  is not None):
+                z_w = z_h = 1
+                h = int(self.display_height)
+                w = int(self.display_width)
+                if w and h:
+                    if w < width:
+                        z_w = w / float(width)
+                    if h < height:
+                        z_h = h / float(height)
+                    zoom = min(z_w, z_h)
+                    width = int(zoom * width)
+                    height = int(zoom * height)
+                #import pdb;pdb.set_trace()
+        title = image_title
+        image_info = {
+            'empty_file': empty_file,
+            'session_file': session_file,
+            'current_filename': title,
+            'size': size,
+            'last_modified': last_modified,
+            'content_url': content_url,
+            'mimetype': mimetype,
+            }
+        alt = title or ''
+        #height = int(self.display_height)
+        #width = int(self.display_width)
+        if height is None or width is None:
+            tag = renderHtmlTag('img', src=image_info['content_url'],
+                                alt=alt, title=title)
+        else:
+            tag = renderHtmlTag('img', src=image_info['content_url'],
+                                width=str(width), height=str(height),
+                                alt=alt, title=title)
+
+        image_info['height'] = height
+        image_info['width'] = width
+        image_info['image_tag'] = tag
+        return image_info
+    ###)
+
+    def checkFileName(self, filename, mimetype):
+        return '', {}
+        if mimetype and mimetype.startswith('image'):
+            return '', {}
+        return 'cpsschemas_err_image', {}
+
+    def prepare(self, datastructure, **kw): ###(
+        """Prepare datastructure from datamodel."""
+        datamodel = datastructure.getDataModel()
+        widget_id = self.getWidgetId()
+        file_name = datamodel[self.fields[0]]
+        #import pdb; pdb.set_trace()
+        if self.allow_resize:
+            datastructure[self.getWidgetId() + '_resize'] = ''
+        datastructure[widget_id] = file_name
+        datastructure[widget_id + '_choice'] = 'change'
+        title = 'Passport Foto'
+        datastructure[widget_id + '_filename'] = title
+    ###)
+
+    def validate(self, datastructure, **kw): ###(
+        """Update datamodel from user data in datastructure.
+        """
+        logger = logging.getLogger('Widgets.FileImageWidget.validate')
+        datamodel = datastructure.getDataModel()
+        field_id = self.fields[0]
+        widget_id = self.getWidgetId()
+        store = False
+        fileupload = None
+        mimetype = None
+        old_file = datamodel[field_id]
+        # if old_file is not None:
+        #     old_filename = old_file.title
+        # else:
+        #     old_filename = ''
+        choice = datastructure[widget_id+'_choice']
+        fileupload = datastructure[widget_id]
+        is_upload = isinstance(fileupload, FileUpload)
+        #import pdb; pdb.set_trace()
+        if not is_upload and not datamodel[field_id]:
+            if self.is_required:
+                return self.validateError('Picture upload required', {},
+                                          datastructure)
+        if self.id_field == "":
+            student_id = self.getStudentId()
+        else:
+            student_id = datastructure[self.id_field]
+        if choice == 'delete':
+            if self.is_required:
+                return self.validateError('cpsschemas_err_required', {},
+                                          datastructure)
+            ext ='jpg'
+            filename = "%s_%s.%s" % (self.getWidgetId(),
+                                     student_id,
+                                     ext)
+            # Remove the file in the filesystem
+            student_path = os.path.join(self.storage_path,student_id)
+            full_path = os.path.join(student_path, filename)
+            if os.path.exists(full_path):
+                os.remove(full_path)
+            datamodel[field_id] = None
+        elif choice == 'keep':
+            fileupload = datastructure[widget_id]
+            if isinstance(fileupload, PersistableFileUpload):
+                # Keeping something from the session means we
+                # actually want to store it.
+                store = True
+            # else:
+            #     # Nothing to change, don't pollute datastructure
+            #     # with something costly already stored, which therefore
+            #     # doesn't need to be kept in the session.
+            #     self.unprepare(datastructure)
+        elif choice == 'change' and is_upload:
+            if not fileupload:
+                return self.validateError('cpsschemas_err_file_empty', {},
+                                          datastructure)
+            if not isinstance(fileupload, FileUpload):
+                return self.validateError('cpsschemas_err_file', {},
+                                          datastructure)
+            fileupload.seek(0, 2) # end of file
+            size = fileupload.tell()
+            if not size:
+                return self.validateError('cpsschemas_err_file_empty', {},
+                                          datastructure)
+            if self.size_max and size > self.size_max:
+                max_size_str = self.getHumanReadableSize(self.size_max)
+                err = 'This file is too big, the allowed max size is ${max_size}'
+                logger.info('%s tried to upload picture with size %dk' %(datastructure['reg_no'],int(size)/1000) )
+                err_mapping = {'max_size': max_size_str}
+                return self.validateError(err, err_mapping, datastructure)
+            store = True
+
+
+        # Find filename
+        if is_upload and store:
+            ext ='jpg'
+            filename = "%s_%s.%s" % (self.getWidgetId(),
+                                     student_id,
+                                     ext)
+            datamodel[field_id] = filename
+            registry = getToolByName(self, 'mimetypes_registry')
+            mimetype = registry.lookupExtension(filename.lower())
+            if mimetype is not None:
+                mimetype = str(mimetype) # normalize
+            #import pdb; pdb.set_trace()
+            file = self.makeFile(filename, fileupload, datastructure)
+            # Fixup mimetype
+            if mimetype and file.content_type != mimetype:
+                file.content_type = mimetype
+            # Store the file in the filesystem
+            student_path = os.path.join(self.storage_path,student_id)
+            if not os.path.exists(student_path):
+                os.mkdir(student_path)
+            full_path = os.path.join(student_path, filename)
+            #import pdb;pdb.set_trace()
+            pict = open(full_path,"w")
+            fileupload.seek(0)
+            pict.write(fileupload.read())
+            pict.close()
+        return True
+
+###)
+
+    def render(self, mode, datastructure, **kw): ###(
+        render_method = 'widget_image_render'
+        meth = getattr(self, render_method, None)
+        if meth is None:
+            raise RuntimeError("Unknown Render Method %s for widget type %s"
+                               % (render_method, self.getId()))
+        img_info = self.getImageInfo(datastructure)
+        return meth(mode=mode, datastructure=datastructure, **img_info)
+    ###)
+
+InitializeClass(FileImageWidget)
+
+widgetRegistry.register(FileImageWidget)
+###)
 
 ###########
Index: WAeUP_SRP/base/skins/waeup_student/getApplicationInfo.py
===================================================================
--- WAeUP_SRP/base/skins/waeup_student/getApplicationInfo.py	(revision 2334)
+++ WAeUP_SRP/base/skins/waeup_student/getApplicationInfo.py	(revision 2335)
@@ -12,6 +12,4 @@
 return Info about the current Student
 """
-import logging
-logger = logging.getLogger('Skins.getApplicationInfo')
 
 request = context.REQUEST
@@ -28,4 +26,6 @@
 requested_id = context.getStudentId()
 if requested_id and not context.isStaff() and member_id != requested_id:
+    import logging
+    logger = logging.getLogger('Skins.getApplicationInfo')
     logger.info('%s tried to access application object of %s' % (member_id,requested_id))
     student_id = requested_id
Index: WAeUP_SRP/base/skins/waeup_utilities/viewimage.py
===================================================================
--- WAeUP_SRP/base/skins/waeup_utilities/viewimage.py	(revision 2334)
+++ WAeUP_SRP/base/skins/waeup_utilities/viewimage.py	(revision 2335)
@@ -5,5 +5,5 @@
 ##bind script=script
 ##bind subpath=traverse_subpath
-##parameters=path
+##parameters=path=None
 ##title=
 ##
@@ -16,4 +16,6 @@
     def set_trace():
         pass
+if path is None and traverse_subpath:
+    path = "/".join(traverse_subpath)
 return context.waeup_tool.showFsPicture(path)
 #import logging
