Jump to content
Sign in to follow this  
pconkie

User photos

Recommended Posts

Just been told by the service desk that there is no way to bulk upload user photos into frog user accounts using frog extractor   :(

If I upload the photos to frogdrive and I know which photo is linked to which user account, is there a way to do it with FrogCode? 

1. Starting with user1, I would need to go and get user1_photo.

2. Attach (copy) user1_photo to user1 account and update (save)

3. Move onto user2...

I can do 1 & 3, but not 2.

Anyone got any ideas? Don't fancy manually updating almost 2000 user accounts! Just think about all the possibilities like visual class lists, seating plans etc

Paul

  • Like 1

Share this post


Link to post
Share on other sites

I've figured this out, sort of....

Approached it from a completely different way by making a 'remote control' for frog.  Was able to leave a computer with the remote control running and by the end of the day it had assigned photos correctly to 98% of students.

It's a fairly complicated set-up but if anyone wants the students photos in frog then i'm happy to share the steps and the code.

  • Like 1

Share this post


Link to post
Share on other sites

It's not that amazing Graham. 'Proper developers' should avert their eyes from the following 'code' or build photo extraction into the frog extractor! I need to put a health warning on this too. Potentially you may end up attaching the wrong photo to every student and/or getting in a right mess with your user database. Use at your own risk.

Outline of the steps:

1. Get all your photos in a folder.

Can't really help with this step - suggestions would be ask your NM to get them out of SIMS or get hold the discs the photography company sent you. There are a few free programs out there like this one http://www.salamandersoft.co.uk/free-utilities/ that will do it.

2. Go to frog and log in as admin.  Open the Users app, click the cog and then 'Export'. 

This will give you a spreadsheet of all users in frog. Delete all non student rows and then delete all non MIS-linked rows. Your images from step 1 are likely named by UPN or admission number, so you need to keep the UPN or roll number column. The import into frog requires the frog uuid and frog username fields, so keep these columns too.  The other columns can be deleted.

3. Rename all the photos so that they are in the format {frog_uuid}-{frog_username}.jpg (or .png or .gif but not .bmp).

I've got a vb script that will loop through the cleaned up spreadsheet from step 2 and re-name the images for you which i will add to this post when i find it again!

4. Take say 20 images to do a test run with first!

Zip them up and upload them to a folder in your frog drive (you will want to delete these images when you have finished. It will be much easier to delete one folder than each image individually!). In frog drive select the zip archive click on the cog and select 'unzip'.  I've noticed that frog really struggles to unzip archives with more than 200 files in them, so you may have to divide your images into several zip files when you are ready to import the lot.

Delete the zip archive(s) once all images have been unzipped. Get the uuid of the folder your images are stored in using the inspector.

5. Remote control: Create a new site and add a html widget 

Here is the code to add to the html widget

<div class="mybox">
    
<button data-name="go">Start Photo Assignment</button><br /><br />
<div data-name="log"></div>

</div>

<style>
 .mybox {
    margin-top: 100px;
    margin-bottom: 100px;
    margin-right: 150px;
    margin-left: 80px;
}
    
</style>
    
<script>
var $log = this.element.find("[data-name=log]");
var $mybtn = this.element.find("[data-name=go]");

var image_folder = '5B1A7E882002F46440CF5F6A824FBB052A5F009CC54A2D99';
var x = 1; 
var i = 1;
var start = Date.now();
var thisDelay = 0;
var subdelay = 10;
   

 $mybtn.click(function() {
     x = 1;
     i = 1;
     subdelay = 10;
     thisDelay = 0;
     $log.append(moment().format("hh:mm:ss a") + ": preparing to add images.... please wait<br />");
     getImages();
});
    
    
 function getImages() {
 Frog.Model
	.api('resources.getOfType', {
		sources: ["native"],
		type: 'staff',
		author: 'true',
        root_folder: 'EDAAA0E92002F81B92C2DFCD917CAC05E532634CEE5FEBD9',
		folder: image_folder,
		filter: null,
		exclude_template: 'true'
	}).done(function(listResponse) {
	    var files = listResponse.data.resources;
       $log.append(moment().format("hh:mm:ss a") + ": found " + ($(files).length+1) + " images<br />");
        var interval = 0;
		  $.each(files, function(index,file) {
            var e = file.attachment.name.split("-");
            setTimeout(updatephoto(e[0], e[1], file.uuid, interval, i),interval);
            interval = interval + 33000 + x;
		    x = x + 10;
            i = i + 1;
        });
	});
 }
    
 function updatephoto(uuid, username, photo, mytime, myi) {
    setTimeout(function(){ $log.append(moment().format("hh:mm:ss a") + ": #" + myi + " Updating user "+username+"</div>"); }, mytime);
    setTimeout(function(){ start = Date.now(); $(".app-users .search input:first").val(username).keyup(); $log.append("...searching..."); thisDelay = Date.now() - start; }, mytime+thisDelay+2000);
    setTimeout(function(){ start = Date.now(); $(".app-users .user-table .users_models_user_"+uuid+":first").trigger("click"); $log.append("selecting user..."); thisDelay = Date.now() - start; }, mytime+thisDelay+7000);
    setTimeout(function(){ start = Date.now(); $(".app-users .users_edit .action-edit:first").trigger("click"); $log.append("editing..."); thisDelay = Date.now() - start; }, mytime+thisDelay+thisDelay+10000);
    setTimeout(function(){ start = Date.now(); $(".app-users .users_edit .change-photo:first").trigger("click");  $log.append("choosing photo..."); thisDelay = Date.now() - start; }, mytime+thisDelay+13000);
    setTimeout(function(){ start = Date.now(); $(".app-resources .resources_mydocuments .lib_models_folder_"+image_folder+":first").trigger("dblclick"); thisDelay = Date.now() - start; }, mytime+thisDelay+17000);
    setTimeout(function(){ start = Date.now(); $(".app-resources .resources_mydocuments .lib_models_resource_"+photo+":first").trigger("click");  $log.append("selecting photo..."); thisDelay = Date.now() - start; }, mytime+thisDelay+21000);
    setTimeout(function(){ start = Date.now(); $(".app-resources [data-action=use]:first").trigger("click"); thisDelay = Date.now() - start; }, mytime+thisDelay+23000);
    setTimeout(function(){ start = Date.now(); $(".app-users .users_edit .action-save:first").trigger("click");  $log.append("saving..."); thisDelay = Date.now() - start; }, mytime+thisDelay+26000);
    setTimeout(function(){ start = Date.now(); $(".app-resources").prev().find('a.ui-dialog-titlebar-close').trigger("click"); $(".app-users .users_edit .breadcrumbs .os-breadcrumb-link:first").trigger("click");  $log.append("exiting<br />"); thisDelay = Date.now() - start; }, mytime+thisDelay+29000);
 }
   
</script>

Change var image_folder = ''; to the uuid of your folder from step 4

Make sure when you are ready to try this, to open the users app!  Your frog drive doesn't need to be open and probably should be closed.  This script has a button, which when pressed gets the contents of your images folder.  For each image in the folder the file name of the image is split and the frog username is used to search for the student in the user database while the frog uuid is used to open the correct student record from the users returned from the search. The following sequence then occurs as a series of timed events:

1. Remote control performs search for student in users database and return matches (5 seconds allowed for this)

2. Remote control opens the correct student record (3 seconds allowed for this)

3. Remote control presses the "Edit" button (3 seconds)

4. Remote control presses the "Change Photo" button (3 seconds)

5. Remote control opens the correct folder in frog drive (4 seconds)

6. Remote control selects correct image (2 seconds)

7. Remote control selects correct image (2 seconds)

8. Remote control presses the 'Use' button (2 seconds)

9. Remote control presses the 'Save' button (3 seconds)

10. Remote control closes frog drive if not already closed and closes the users record, returning to the use search results (3 seconds)

There is some attempt in the code to make adjustments to this timing based upon any major delays cause by the server or more likely your browser. You may need to alter these timing depending on the speed of your network. You may beable to shorten these timings!  If you make a few copies of the site and set up images in a few folder it is possible to use different browser (eg chrome, FF and IE) at the same time on the same computer to get this done much faster.

The code outputs a log of sorts to the site so that you can get an idea of how far along you have got.

Here we are purposefully using $() rather than this.element.find because we WANT to affect things (very carefully) outside the site.

 

Edited by pconkie
  • Like 1

Share this post


Link to post
Share on other sites

@pconkie has prompted some conversations here and one of our amazing devs spent his lunch hour creating this:

Capture.JPG.13b4c3bfa066884c8c132c0d099d7d27.JPG

Right now, it's a service desk tool and completely untested, but... with a fair wind and proper QA, we might get this ready for September.

  • Like 4

Share this post


Link to post
Share on other sites

Isn't this kind of important for the new MyFrog app and new Menu design????  Dont the previews show the users image on it????

Share this post


Link to post
Share on other sites

I'll take that back....  I'm sure it had a picture of the user in the little circle...  but not any more!!! Hmmmmmm!!  O and speaking of which them links you sent me so i could embed the prototype designs into me September Training site no longer work????

Edited by ADT

Share this post


Link to post
Share on other sites
15 hours ago, ADT said:

I'll take that back....  I'm sure it had a picture of the user in the little circle...  but not any more!!! Hmmmmmm!!  O and speaking of which them links you sent me so i could embed the prototype designs into me September Training site no longer work????

The student photo was indeed in the app and may return, but it was pointed out that we don't have photos in the platform that prompted both the service desk tool and the redesign.

The prototypes change on a regular basis.  I update the links on the community site when they do.   This is down to how Adobe's prototyping system works - sorry 

Share this post


Link to post
Share on other sites
7 hours ago, Graham Quince said:

The student photo was indeed in the app and may return, but it was pointed out that we don't have photos in the platform that prompted both the service desk tool and the redesign.

The prototypes change on a regular basis.  I update the links on the community site when they do.   This is down to how Adobe's prototyping system works - sorry 

Again the pictures are in Frog 3...............  imported by the extractor....... Good old Frog 3!!!!

Share this post


Link to post
Share on other sites

OK so where are we with this now????  Do we have access to a tool......  or is the tool still only at Frog HQ???   If we do upload images where will they be visible???  Could kids access each others pictures???  So many questions??????????? :P

@Graham Quince

Share this post


Link to post
Share on other sites

The release notes from Christie cover this:

https://www.frogcommunity.com/app/os#!christie/learn/users-application---student-photos-improvement

It is a tool the Service Desk use, they'll talk you through where to upload the images in bulk.  Students should not be able to view others photos - as each image is renamed with a UUID and that identifier is then associated to the students' UUID. 

 

  • Thanks 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...