Upload Image problem no thumbnail is created

Permalink 3 users found helpful
Hi there,
I am trying to upload a jpeg through the file manager.

All I get is the upload "processing" (with the spinney logo) and nothing else hapeens.

I click away from the file manager to [say] "sitemap" go back to the file manager and the image is uploaded but with a default thumbnail of some flowers.

SO I can not see the image thumb and I also had no option to add the image to a set.

Has anyone seen this issue before?

THanks

D!!

p.s Also the bacth file uplaod will not work at all.

p.p.s when I try to upload a .kml (google maps file) I can assign a set and it seems to function as it should (no thumbnail is the default for docs I assume)

dancer
 
Kiesel replied on at Permalink Reply
I have the same problem. I also noticed a strange behavior with the multiple file upload and think this is connected.

I upload for example 4 files. Small ones and big ones.

All 4 get uploaded, but 2 of them show no thumbnail.

If I take the images without a thumbnail and edit them in picnic and reduce the size down to e.g 800x600 and export them the thumbnail appears.


In a test I've uploaded 14 Images.

While uploading them, 10 showed the message "Upload successful" and by 4 the grey status bar filled up but stayed and no message of success showed up.

I checked after the missing thumbnails and the same 4 with the grey status bar had missing thumbnails.

> 4288x2848 / 8.90 MB
> 4288x2848 / 8.41 MB
> 4288x2848 / 10.80 MB
> 4288x2848 / 2.70 MB

So far File size and Resolution come to mind,
but this image on the other hand got a thumbnail:

> 4001x2657 / 6.47 MB

Again, all of the files got uploaded successfully, just the thumbnail creation and Error reporting seems to have a problem.
Kiesel replied on at Permalink Reply
I also noticed that when I try to upload on the single file loader a huge file (300 MB .avi) I'm not getting any error message - I think there should normally pop up a big error about the filesize, no?
Kiesel replied on at Permalink Reply
I spent some time with that problem and found a solution that works at least for the single file upload:

If you upload an image and it keeps telling you that it is processing, then the skript most likely got stuck here:

In concrete/helpers/image.php
~line 63: $im = @imageCreateFromJPEG($originalPath);

The File got correctly uploaded, but the Thumbnail cannot be created.

I was able to fix it by either adding to the .htaccess file:

php_value memory_limit 50M

Or by adding the following line in the create function:

ini_set('memory_limit', '50M');

It also depends of course if your provider let you do this ^^.

------------------

If you still have problems with the fileupload (also maybe different ones) try adding these to your .htaccess file:

<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>

php_value post_max_size 50M
php_value upload_max_filesize 50M
php_value max_execution_time 1200
php_value max_input_time 1200


----------------------

Obviously the GD Lib needs A LOT of memory to work with images. I think the proper solution would be to change the core and use for image manipulations image magick.

That would solve problems like this - and it is really great anyway.
Kiesel replied on at Permalink Reply
So the problem are images with a high resolution. This max resolution depends on your memory. I found a good article about this here:

http://www.francodacosta.com/blog/development/php-development/do-so...

Another approach then simply giving more memory or waiting on an update would be to catch the file right after the upload and before the GD Lib is trying to work on it.

We just take the file and resize it to a size the GD Lib is able to handle with your amount of memory.

That's what I use now. You only have to make sure you have ImageMagick on your server (which is normally not a problem). I did this with concrete5 - 5.4.0.5

I copied concrete/libraries/file/importer.php to
libraries/file/importer.php and added the following under $fv = File::add($filename, $prefix); (around line ~137):

$file_info = getimagesize($fv->getPath());
if( (($file_info[2] == 1) || ($file_info[2] == 2) || ($file_info[2] == 3) )&&($file_info[0] > 800 || $file_info[1] > 600) ){
exec("convert '".$fv->getPath()."' -resize 800x600 '".$fv->getPath()."'");
}

you also have to copy this 4 lines a second time and place it under:

$fv = $fr->getVersionToModify(true);

in (~line 143), so if you use the "replace" on a file the resizing works here too.

Your image will be resized right after uploading trough ImageMagick to max width/height 800x600 - in my case nobody needs any higher resolution, in fact higher resolution is unwelcome.

1-3 stands for gif,jpg,png.

Now my editors can upload images straight out of digital cameras in single and multi uploads and don't have to worry about anything. Thumbnail gets always created, Upload never seems to be stuck and they don't have to fight with over sized images.

Hope that helps somebody.
Pritam replied on at Permalink Reply
Thanks Jason your fix works like a charm especially the last post. Gonna mark this as a helpful thread.

:)
Kiesel replied on at Permalink Reply
Glad it helps you. One thing I just noticed a day ago is that I forgot to put the $fv-getPath() into ''. So if you use files with spaces in the name it doesn't work.

You may wanna change that by your implementation (I fixed it in the post with the code allready)
Pritam replied on at Permalink Reply
Thanks for the heads up, I tried adding the " as mentioned in your edited post , and tried uploading a file with spaces in the file name and it gives me an error that says

"Parse error: syntax error, unexpected T_ELSE, expecting T_FUNCTION in importer.php on line 143"

wonder what went wrong !!

So I reverted back to the old code and tried uploading an image file with spaces in the name and it uploaded perfectly well.

:P
Kiesel replied on at Permalink Reply
I think you used double quotes instead of the single ' quotes.

If you copy my above code now, then it should work too. With the old code the upload should still work but files with spaces will not be resized.