Hi Leire
 
I just read this after I sent the previous email, and yes that makes sense that it is Internet Explorer that is returning
the wrong mimetype while Firefox is returning the correct one.
 
And the solution is the same as my last email, using a CURL lookup call eg:
 
  /**
     * Uses CURL to get the content type of a url document (mime_content_type cannot do this, so CURL to the rescue).
     *
     * @access  public
     * @param   string $url The HTTP url
     * @param   string $follow_location
     * @param   integer $timeout The http session timeout
     * @return  string The formatted time
     */
 function get_content_type($url,$follow_location = TRUE,$timeout = 5) {
  $ch = curl_init($url);
  curl_setopt($ch, CURLOPT_FOLLOWLOCATION,$follow_location);
  curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
  curl_setopt($ch, CURLOPT_HEADER, TRUE);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER,TRUE);
      if (APP_HTTPS_CURL_CHECK_CERT == "OFF")  {
   curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
   curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
  }
 
  curl_exec($ch);
  if (($c = curl_getinfo($ch,CURLINFO_HTTP_CODE)) < 200 || $c >= 300) {
   curl_close($ch);
   return FALSE;
  } 
  $type = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
  curl_close($ch);
  return $type;
}
 
I think this is already in class.misc.php in Fez 1.2, but this may be more up to date.
 
Cheers,
Christiaan


From: fez-users-bounces@lists.sourceforge.net [mailto:fez-users-bounces@lists.sourceforge.net] On Behalf Of Leire Urcelay
Sent: Thursday, 23 November 2006 1:44 AM
To: fez-users@lists.sourceforge.net
Subject: [Fez-users] RE : Uploading Photoshop images

Hi again,

 

I would like to clarify my previous message, since I mixed some concepts… sorry…

 

Jhove is used for retrieving the Preservation Metadata of a file.  In case we are uploading a Photoshop image, as Jhove doesn’t recognise this kind of file, it just sets ‘application/octet-stream’ value to mime type attribute and default values to format and status attributes.

 

Regarding the Ingest Image workflow, this workflow is triggered during the upload file process, if the file’s mime type corresponds to one of the mime types associated to the Ingest Image workflow.  I don’t know if I have understood the whole process, but it seems that the mime type of the uploaded file is provided by the browser, isn’t it? For example, when uploading .fff files, Internet Explorer sets the mime type as “image/tiff”, which is right, while Firefox sets it as “application/octet-stream”.

 

The problem of this approach is that the behaviour of the application depends on the client browser.  I wonder if there is a proper way to identify if a mime type is correct or not, and then, in case it isn’t correct, a way to update it correctly.  What do you think?  I think that it can be very useful, at lest when uploading images, since the mime type determines if the Ingest Image is triggered or not.

 

Thanks for your help.

 

Leire Urcelay