Keyword

Image upload error K2.7 and J3.5

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 4 months ago #159613 by Krikor Boghossian
Replied by Krikor Boghossian on topic Image upload error K2.7 and J3.5
Which version of PHP are you using?

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

More
7 years 4 months ago #159625 by Scott Oman
Replied by Scott Oman on topic Image upload error K2.7 and J3.5
I am using:
PHP 5.6.27
Joomla! 3.6.4 Stable
K2 2.7.2

I cannot upgrade to PHP 7.0.4. due to server restrictions.

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

More
7 years 4 months ago #159685 by Scott Oman
Replied by Scott Oman on topic Image upload error K2.7 and J3.5
Hi again!

Any information on this issue?

I am using:
PHP 5.6.27
Joomla! 3.6.4 Stable
K2 2.7.2

Thanks!

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 4 months ago #159692 by Krikor Boghossian
Replied by Krikor Boghossian on topic Image upload error K2.7 and J3.5
I cannot reproduce the issue under PHP 5.6 unfortunately.
Are you using any other extensions, K2 related as well?

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

More
7 years 4 months ago - 7 years 4 months ago #159697 by Scott Oman
Replied by Scott Oman on topic Image upload error K2.7 and J3.5
I'm using a lot of extensions. Using k2 comments module etc. The only non-k2 extension that is related to k2 is Je k2 Story, which allows users to submit content.

But as mentioned, when I installed the latest k2 2.7.0 , the issue went away.

It came back after installing 2.7.1 and remained after installing the dev version.

Can I just reinstall the latest 2.7.0 version?

Or do you have other ideas?

I can pm you login credentials if you'd like to check yourself.

Thanks.
Last edit: 7 years 4 months ago by Scott Oman.

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

More
7 years 3 months ago #159805 by Scott Oman
Replied by Scott Oman on topic Image upload error K2.7 and J3.5
Any information about this issue?

Can I just reinstall the k2 2.7.0 version?

Will it override the dev version?

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 3 months ago #159832 by Krikor Boghossian
Replied by Krikor Boghossian on topic Image upload error K2.7 and J3.5
It will and you will lose bug fixes and enhancements.
You can try 2.7.0 for the time-being.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

More
7 years 3 months ago #159924 by Scott Oman
Replied by Scott Oman on topic Image upload error K2.7 and J3.5
Yeah if I use K2 2.7.0 it solves the problem for me, but if I upgrade it comes right back. :(

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 3 months ago #160013 by Krikor Boghossian
Replied by Krikor Boghossian on topic Image upload error K2.7 and J3.5
I have not been able to reproduce the issue under PHP 5.6.x and 7.0.x.
Sadly without being able to reproduce the issue (2.7.1 and 2.7.2) I cannot provide a solution.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

More
7 years 2 months ago #160519 by wrina
Replied by wrina on topic Image upload error K2.7 and J3.5
Has there a solution for this problem yet.
I have K2 v2.7.1
Joomla 3.6.5

I am not able to save images.
I have reviewed the fix: www.joomlaworks.net/forum/k2-en/45116-image-upload-error-k2-7-and-j3-5

My system file is not the same, however I still have the problem. What is the edit to the item.php file to ensure images are saved to the database?? ::

//Image
if ((int)$params->get('imageMemoryLimit'))
{
ini_set('memory_limit', (int)$params->get('imageMemoryLimit').'M');
}
$existingImage = JRequest::getVar('existingImage');
if (($files == 0 || $existingImage) && !JRequest::getBool('del_image'))
{

if ($files == 0)
{
$image = $files;
}
else
{
$image = JPATH_SITE.DS.JPath::clean($existingImage);
}

$handle = new Upload($image);
$handle->allowed = array('image/*');
$handle->forbidden = array('image/tiff');

if ($handle->file_is_image && $handle->uploaded)
{
//Image params
$category = JTable::getInstance('K2Category', 'Table');
$category->load($row->catid);
$cparams = class_exists('JParameter') ? new JParameter($category->params) : new JRegistry($category->params);

if ($cparams->get('inheritFrom'))
{
$masterCategoryID = $cparams->get('inheritFrom');
$query = "SELECT * FROM #__k2_categories WHERE id=".(int)$masterCategoryID;
$db->setQuery($query, 0, 1);
$masterCategory = $db->loadObject();
$cparams = class_exists('JParameter') ? new JParameter($masterCategory->params) : new JRegistry($masterCategory->params);
}

$params->merge($cparams);

//Original image
$savepath = JPATH_SITE.DS.'media'.DS.'k2'.DS.'items'.DS.'src';
$handle->image_convert = 'jpg';
$handle->jpeg_quality = 100;
$handle->file_auto_rename = false;
$handle->file_overwrite = true;
$handle->file_new_name_body = md5("Image".$row->id);
$handle->Process($savepath);

$filename = $handle->file_dst_name_body;
$savepath = JPATH_SITE.DS.'media'.DS.'k2'.DS.'items'.DS.'cache';

//XLarge image
$handle->image_resize = true;
$handle->image_ratio_y = true;
$handle->image_convert = 'jpg';
$handle->jpeg_quality = $params->get('imagesQuality');
$handle->file_auto_rename = false;
$handle->file_overwrite = true;
$handle->file_new_name_body = $filename.'_XL';
if (JRequest::getInt('itemImageXL'))
{
$imageWidth = JRequest::getInt('itemImageXL');
}
else
{
$imageWidth = $params->get('itemImageXL', '800');
}
$handle->image_x = $imageWidth;
$handle->Process($savepath);

//Large image
$handle->image_resize = true;
$handle->image_ratio_y = true;
$handle->image_convert = 'jpg';
$handle->jpeg_quality = $params->get('imagesQuality');
$handle->file_auto_rename = false;
$handle->file_overwrite = true;
$handle->file_new_name_body = $filename.'_L';
if (JRequest::getInt('itemImageL'))
{
$imageWidth = JRequest::getInt('itemImageL');
}
else
{
$imageWidth = $params->get('itemImageL', '600');
}
$handle->image_x = $imageWidth;
$handle->Process($savepath);

//Medium image
$handle->image_resize = true;
$handle->image_ratio_y = true;
$handle->image_convert = 'jpg';
$handle->jpeg_quality = $params->get('imagesQuality');
$handle->file_auto_rename = false;
$handle->file_overwrite = true;
$handle->file_new_name_body = $filename.'_M';
if (JRequest::getInt('itemImageM'))
{$imageWidth = JRequest::getInt('itemImageM');}
else
{
$imageWidth = $params->get('itemImageM', '400');
}
$handle->image_x = $imageWidth;
$handle->Process($savepath);

//Small image
$handle->image_resize = true;
$handle->image_ratio_y = true;
$handle->image_convert = 'jpg';
$handle->jpeg_quality = $params->get('imagesQuality');
$handle->file_auto_rename = false;
$handle->file_overwrite = true;
$handle->file_new_name_body = $filename.'_S';
if (JRequest::getInt('itemImageS'))
{
$imageWidth = JRequest::getInt('itemImageS');
}
else
{
$imageWidth = $params->get('itemImageS', '200');
}
$handle->image_x = $imageWidth;
$handle->Process($savepath);

//XSmall image
$handle->image_resize = true;
$handle->image_ratio_y = true;
$handle->image_convert = 'jpg';
$handle->jpeg_quality = $params->get('imagesQuality');
$handle->file_auto_rename = false;
$handle->file_overwrite = true;
$handle->file_new_name_body = $filename.'_XS';
if (JRequest::getInt('itemImageXS'))
{
$imageWidth = JRequest::getInt('itemImageXS');
}
else
{
$imageWidth = $params->get('itemImageXS', '100');
}
$handle->image_x = $imageWidth;
$handle->Process($savepath);

//Generic image
$handle->image_resize = true;
$handle->image_ratio_y = true;
$handle->image_convert = 'jpg';
$handle->jpeg_quality = $params->get('imagesQuality');
$handle->file_auto_rename = false;
$handle->file_overwrite = true;
$handle->file_new_name_body = $filename.'_Generic';
$imageWidth = $params->get('itemImageGeneric', '300');
$handle->image_x = $imageWidth;
$handle->Process($savepath);

if ($files == 0)
$handle->Clean();

}
else
{
$mainframe->enqueueMessage(JText::_('K2_IMAGE_WAS_NOT_UPLOADED'), 'notice');
}

}

if (JRequest::getBool('del_image'))
{

$current = JTable::getInstance('K2Item', 'Table');
$current->load($row->id);
$filename = md5("Image".$current->id);

if (JFile::exists(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'items'.DS.'src'.DS.$filename.'.jpg'))
{
JFile::delete(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'items'.DS.'src'.DS.$filename.'.jpg');
}

if (JFile::exists(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.$filename.'_XS.jpg'))
{
JFile::delete(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.$filename.'_XS.jpg');
}

if (JFile::exists(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.$filename.'_S.jpg'))
{
JFile::delete(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.$filename.'_S.jpg');
}

if (JFile::exists(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.$filename.'_M.jpg'))
{
JFile::delete(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.$filename.'_M.jpg');
}

if (JFile::exists(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.$filename.'_L.jpg'))
{
JFile::delete(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.$filename.'_L.jpg');
}

if (JFile::exists(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.$filename.'_XL.jpg'))
{
JFile::delete(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.$filename.'_XL.jpg');
}

if (JFile::exists(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.$filename.'_Generic.jpg'))
{
JFile::delete(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.$filename.'_Generic.jpg');
}

$row->image_caption = '';
$row->image_credits = '';

}

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


Powered by Kunena Forum