Hi forum,
I have a little problem that i don't understand...
I create a module to mass upload pictures. One of the feature is to offer a cck field who embed the "uploadify" jquery plugin.
I add my cck field into a content-type, and test it. I click the browse button, select some files and upload it into the system. for each uploaded file, I use the file_save_upload method to save the file into the "files" database table.
Once it's ok, I would like to retrieve my pictures and display it into the form. I use ajax to do it, with a function like this :
function my_uploadify_retrieve_ajax( $fids ) {
$output = "";
$list = implode( ", ", explode( "-", $fids ) );
$res = db_query( db_rewrite_sql( "SELECT fid, filename, filepath, filesize FROM {files} WHERE fid in (%s)"), $list );
while( $file = db_fetch_object( $res ) ) {
$picture = new StdClass();
$path = imagecache_create_url( "thumb", $file->filepath );
$image = theme_imagecache( "thumb",
$file->filepath,
"",
"",
array( "class" => "thumb", "id" => "thumb_" . $file->fid ) );
$picture->thumbnail = $image;
$picture->fid = $file->fid;
$output .= theme( "my_uploadify_cck_thumbnail", $picture );
}
drupal_json( array( 'data' => $output ) );
}
To get pictures with javascript, I have a JS file with this kind of code :
$.get(Drupal.settings.basePath+'my-uploadify/picture/retrieve/' + s, null, imagesDetails);
var imagesDetails = function( response ) {
var result = eval('(' + response + ')' );
jQuery('#field_test_container').html( result.data );
}
My problem is that when the pictures are retrieved, some of them are rotated... My "thumb" imagecache preset only resize the pictures, it don't rotate it. But in the form display, all pictures are show with a ratio w > h. So if the picture has a ratio h > w, the image is rotated... And I don't understand why... the physic picture is ok, the physic thumbnail generated with imagecache is ok, but at the display, pictures with h>w ratio are rotated... It's crazy but I don't know why.
If anyone can help me it would be great.
Thanks in advance
Comments
Ok, I fount the
Ok, I fount the solution.
This is because macOS finder use exif informations to auto-rotate picture in previsualisation. But all pictures are saved with the same ratio. When I take a picture with my iphone rotated at 90° the picture is saved at 90° but the finder rotate it auto-magically to display it in the correct orientation, due to the exif informations stored in the picture.
http://www.sabugo.ch
http://www.titouille.ch