Kunena 6.3.0 released

The Kunena team has announce the arrival of Kunena 6.3.0 [K 6.3.0] in stable which is now available for download as a native Joomla extension for J! 4.4.x/5.0.x/5.1.x. This version addresses most of the issues that were discovered in K 6.2 and issues discovered during the last development stages of K 6.3

Solved Image orientation on upload - K 4.06 with Crypsis

More
8 years 5 months ago #1 by WolfgangOWL
Hello folks,

I recently updated from K 4.05 with Blue Eagle template to 4.06 with Crypsis. I modified the upload.php to change the orientation of uploaded images with portrait orientation using the orientation tag of jpg files. This worked fine until before the update. The same modification applied after the update has no effect at all. Can anyone help me with this?

Thanks in advance,
Wolfgang

Please Log in or Create an account to join the conversation.

More
8 years 5 months ago #2 by WolfgangOWL
I found out the reason. Crypsis uses the ajaxUpload function for file uploads. After applying the image rotation there it works fine.

Please Log in or Create an account to join the conversation.

More
8 years 5 months ago #3 by 810
good, could you add the code, how to change it, maybe someone else can use it.

Please Log in or Create an account to join the conversation.

More
8 years 5 months ago #4 by WolfgangOWL

810 wrote: good, could you add the code, how to change it, maybe someone else can use it.


Shure I can.

This is the function which does the image rotation:
Code:
function correctImageOrientation($filename) { $testForJpg = getimagesize($filename); if ($testForJpg[2] == 2) { if (function_exists('exif_read_data')) { $deg = 0; $exif = exif_read_data($filename); if ($exif && isset($exif['Orientation'])) { $orientation = $exif['Orientation']; if ($orientation != 1) { $img = imagecreatefromjpeg($filename); switch ($orientation) { case 3: case 4: $deg = 180; break; case 5: case 6: $deg = 270; break; case 7: case 8: $deg = 90; break; } } } if ($deg > 0) { $img = imagerotate($img, $deg, 0); imagejpeg($img, $filename, 95); } } } }

This code must be placed in function ajaxUpload above of
}
catch (Exception $exception)
{
}
Code:
// get filename from stream $meta_data = stream_get_meta_data($out); $filename = $meta_data["uri"]; $this->correctImageOrientation($filename);

And this must be placed in function upload above of
if (!KunenaFile::copy($file->tmp_name, $file->destination))
{
throw new RuntimeException(JText::_('COM_KUNENA_UPLOAD_ERROR_FILE_RIGHT_MEDIA_DIR'), 500);
}
Code:
$this->correctImageOrientation($file->tmp_name);

Please Log in or Create an account to join the conversation.

Time to create page: 0.803 seconds