upgrade issue; can't upload PNG

15 posts / 0 new
Last post
holmesg
upgrade issue; can't upload PNG

Upgrade of 2.4.0 to 3.1.0

Add new resource, attempting to upload a PNG.

/index.php?P=EditResource&ID=-3&ER=4&EF=28&E1=test.png

  • The image file test.png uploaded for the Screenshot field was in an unsupported image format.
ealmasy
Re: upgrade issue; can't upload PNG

It may be an issue with your PHP installation.  What does it say after Supported Image Formats in the System Information section on the Administration page?

Also, do you have a copy of SPT--EditResourceCommon.html in your local/interface/<name>/include directory?

 

holmesg
Re: upgrade issue; can't upload PNG

It may be an issue with your PHP installation. What does it say after Supported Image Formats in the System Information section on the Administration page?

GIF, PNG

 

Also, do you have a copy of SPT--EditResourceCommon.html in your local/interface//include directory?

We did; I've renamed it but the problem is persisting.

ealmasy
Re: upgrade issue; can't upload PNG

Thanks for the additional info.  Do GIF uploads work?  (Is it just PNG uploads that are failing?)

Do uploads into a File metadata field work?  (Is the problem just with Image fields?)

 

holmesg
Re: upgrade issue; can't upload PNG

     Thanks for the additional info.  Do GIF uploads work?  (Is it just PNG uploads that are failing?)

Ugh, GIF uploads fail too, with the same error message.

  • The image file large.gif uploaded for the Screenshot field was in an unsupported image format.

     Do uploads into a File metadata field work?  (Is the problem just with Image fields?)

Well ... I tried to add a File field to check, and that opened a whole new can of worms.  I can't add the field.

I got errors on the three priviliege fields (wish I had recorded them), so I renamed the local copy of EditMetadataField.html to see if that was the issue. But I still get errors (not sure if they are the same) on those fields:

  • The values given for the Privilege Required for Viewing field are invalid. Unknown condition type
  • The values given for the Privilege Required for Authoring field are invalid. Unknown condition type
  • The values given for the Privilege Required for Editing field are invalid. Unknown condition type

 

chalpin
Re: upgrade issue; can't upload PNG

Thank you again for sending me a copy of your local interface.  It's already been extremely helpful with debugging.

I'm looking at the permissions editing issue, and when I try to load the EditMetadataField page using your interface... and large parts of the field editing interface are broken.  The reason appears to be that your StdPageStart.html is including jquery v1.5 ca line 366.  This is overriding the jQuery v1.7 that is being included on line 304. Because of the version difference, the EditMetadataField page then doesn't have a number of js functions that it requires for the interface to work properly.

There's also a similar issue with jquery-ui.  You're pulling in v 1.10.2, but we're expecting 1.8.21.

I can send you an updated copy of your local interface that doesn't pull in two versions of each, and it'll make the core CWIS functionality work... but I'm not sure what in your local modifications might have depended on those specific version, and how that might break.

holmesg
Re: upgrade issue; can't upload PNG

OK, I was now (after getting jQuery version straightened out) able to add a file field.

The file field does allow uploading a PNG. The screenshot field does not.

ealmasy
Re: upgrade issue; can't upload PNG

We've been completely unable to replicate this problem here at Scout, so we've added some extra diagnostic info to image upload, and will be releasing CWIS 3.1.1 later this week with that addition, which will hopefully provide some insight into the problem and a solution.

holmesg
Re: upgrade issue; can't upload PNG

I think I've finally traced this through!

The problem seems to be:

1. CWIS is trying to convert the PNG to a JPG

2. GD on the server does not have JPG support

output from

var_dump(gd_info()); 

includes

["JPG Support"]=> bool(false)

 

And therefore this test is failing:

if ($this->ImageFormatSupportedByPhp() && $this->ImageFormatSupportedByPhp($NewImageType))
 
in file Axis--Image.php
 

 

 

Is there some reason that CWIS wants to convert the image to a JPG? Is this configurable?

ealmasy
Re: upgrade issue; can't upload PNG

CWIS should not be trying to convert the PNG to a JPG.  Where do you see that (or how do you know it's) happening?

holmesg
Re: upgrade issue; can't upload PNG

I traced it back from geting the 

    The image file test.png (8) uploaded for the Screenshot field was in an unsupported image format.

error.

I looked through the code trying to figure out where this message is coming from.

I found it coming from this function in Axis--Image.php

# save image with a new name and (optionally) a new type
    function SaveAs($FileName, $NewImageType = NULL)
 
The "new image type" is JPG.
 
 
 
 

 

ealmasy
Re: upgrade issue; can't upload PNG

Okay.  Is Image::SaveAs() actually getting IMGTYPE_JPEG for the $NewImageType parameter?  Or is it getting NULL and then trying to determine the image type inside the method?

If SaveAs() is getting NULL for $NewImageType, what's being passed in for $FileName?

holmesg
Re: upgrade issue; can't upload PNG

Is Image::SaveAs() actually getting IMGTYPE_JPEG for the $NewImageType parameter?

Yes.

    # save image with a new name and (optionally) a new type
    function SaveAs($FileName, $NewImageType = NULL)
    {
 
error_log('function SaveAs   $FileName = ' . $FileName . ' $NewImageType = ' . $NewImageType);

 

 

Produces

 

[17-Nov-2014 14:57:39 America/Detroit] function SaveAs   $FileName = local/data/images/previews/Preview--00000029.png $NewImageType = 1

 

ealmasy
Re: upgrade issue; can't upload PNG

Ah, okay.  Could you unzip the attached file, put it into the objects directory for the site, and see if that resolves the problem?

Attachments: 
holmesg
Re: upgrade issue; can't upload PNG

That worked!  Thank you :)