Aha! Now I see the problem. Your zip file has a subdirectory, and the picture files are inside it. The current code expects the picture files not to be in subdirectories at all, so it doesn't find any picture files to process.
I'll see if we can modify the code to handle this situation in an easy way.
Thanks a lot for bringing this up!
Saludos. Iñaki.
Well, it was easier than I expected, so here is a modified uploadpicture.php that handles picture files in subdirectories as well.
Saludos. Iñaki.
And a patch file in case anyone is interested.
Saludos. Iñaki.
I've opened an improvement request in the bug tracker: MDL-14233
Saludos. Iñaki.
A shot in the dark here, but have you tried zipping your images so they will not be in a subdirectory and uploading them that way? To do this:
1. Go inside your directory until you see all your images
2. Select all your images (Ctrl+A)
3. Point to any highlighted image and right click
4. Select "Send to", then "Compressed (zipped) folder"
Now you will have a zip file that will have the name of one of your images, but the zip will contain all your images without them being in a subdirectory. Upload that and be sure to select to overwrite existing pictures.
Steve
please, i have problem uploading bulk pictures to moodle 2.9.2 and i am not uploading from a sub-directory folder. i need help please.
I know nothing of the issue you are reporting, but I do know that "problem uploading" is insufficient information to make it easy to help you.
so, what help are you suggesting i try, i truly need help to upload bulk pictures.
I had the zip file but i got this error;
"User with a 'username' value of '' does not exist. Skipping.
Cannot save picture for user 8b1. Check original picture file."
8b1 is the username. and I have a username with that name.
do you have any ideas?
thanks Enrique
i am also having the same problem like "Cannot save picture for user abc . Check original picture file."
i am having moodle 1.9 installed both in my server and in my local machines.
i installed Linux in my server and xampp in the local which is having XP as OS.
now, the image uploading functionality is working fine in local and its throwing the above said error in my server.
is this error related with Linux, cause its working in windows environment and not in Linux..
i have attached a sample zip file here.
Any idea about this?
This message appears only if:
- Moodle can't create the user directory to hold the user picture
- Moodle can't deal with the image file. 99% of the time this is due to a missing or misconfigured PHP GD extension.
Could you check that you have the PHP GD extension installed and enabled, and that you've set the correct GD version under Administration >> Server >> System Paths?
Saludos. Iñaki.
You are absolutely correct. i already figured that out and changed the settings and its all working fine now..
Thanks for your reply..
What i do is
1. Checked whether my server holds the correct GD Version(needs GD 2.x).
2. Logged in as admin, go to
site administration > server > system paths and
set the gd version "GD 2.x installed".
That's it, i am now able to upload user pictures from admin...
Cheers
Karthick B
Tengo la versión 1.9.5 y en el perfil de usuario no me aparecía la opción de subir las fotos. Ahora ya me aparece la opción.
MUCHAS GRACIAS IÑAKY Y KARTHICK.
Josephine,
I developed that part of the code, so maybe I could help you diagnose what's going on.
The code has extensive status messages telling the admin the progress of the upload, so it's a bit strange that you don't have any of those messages. Anyway, we can add some additional debugging statements and see what gets out
Can you edit .../moodle/admin/uploadpicture.php and add the additional lines marked below?
First code snippet (around line 97)
} else {
$num_files_or_dirs = 0; // <<--- Add this line here
$num_files = 0; // <<--- Add this line here
while (false !== ($item = readdir($handle))) {
$num_files_or_dirs++; // <<--- Add this line here
echo '
Processing file or directory called ' . $item . "\n
"; // <<--- Add this line here
if($item != '.' && $item != '..' && is_file($zipdir.'/'.$item)) {
$num_files++; // <<--- Add this line here
// Add additional checks on the filenames, as they are user
// controlled and we don't want to open any security holes.
Second code snippet (around line 152):
notify(get_string('usersupdated', 'admin') . ": $usersupdated");
notify(get_string('errors', 'admin') . ": $userserrors");
echo '
Number of processed files or directories: ' . $num_files_or_dirs . "\n
"; // <<--- Add this line here
echo '
Number of processed files: ' . $num_files . "\n
"; // <<--- Add this line here
echo '';
Saludos. Iñaki.
Hummm, the code filter has completely munged the second code snippet, so here it goes again:
notify(get_string('usersupdated', 'admin') . ": $usersupdated");
notify(get_string('errors', 'admin') . ": $userserrors");
echo '
Number of processed files/directories: ' . $num_files_or_dirs . "\n
"; // <<--- Add this line here
echo '
Number of processed files: ' . $num_files . "\n
"; // <<--- Add this line here
echo '';
Saludos. Iñaki.
Yes, that is the file. But it seems the filters at Moodle.org keep destroying the second snippet. So here goes a modified file so you can directly use it (keep a clean copy of the original file, just in case).
Saludos. Iñaki.
Iñaki Arenaza is there a way that there is an updated version that will work with 2.2.1? I would like to do the same for our newer moodle install?