- Posts: 26
COMMUNITY FORUM
- Forum
- K2 Community Forum
- English K2 Community
- K2 image upload: hide K2_IMAGE_WAS_NOT_UPLOADED notice
K2 image upload: hide K2_IMAGE_WAS_NOT_UPLOADED notice
- Szymon Pluta
- Topic Author
- Offline
- Junior Member
Less
More
7 years 7 months ago - 7 years 7 months ago #161388
by Szymon Pluta
K2 image upload: hide K2_IMAGE_WAS_NOT_UPLOADED notice was created by Szymon Pluta
Hi,
I noticed that when I save article on front end with turned off (k2 settings) or removed images tab Jooomla show K2_IMAGE_WAS_NOT_UPLOADED notice.
I could modify save() function in com_k2 (just addinside image upload part, but I would rather avoid that.
How to fix it without overriding core file?
Please don't say "make image input file display: none".
http://imgur.com/a/AACQI
I noticed that when I save article on front end with turned off (k2 settings) or removed images tab Jooomla show K2_IMAGE_WAS_NOT_UPLOADED notice.
I could modify save() function in com_k2 (just add
if(!empty($image))
How to fix it without overriding core file?
Please don't say "make image input file display: none".
http://imgur.com/a/AACQI
Last edit: 7 years 7 months ago by Szymon Pluta.
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
7 years 7 months ago #161399
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic K2 image upload: hide K2_IMAGE_WAS_NOT_UPLOADED notice
Hello,
The image is not by default required.
Are you using any 3rd party extensions?
The image is not by default required.
Are you using any 3rd party extensions?
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Szymon Pluta
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 26
7 years 7 months ago #161407
by Szymon Pluta
Replied by Szymon Pluta on topic K2 image upload: hide K2_IMAGE_WAS_NOT_UPLOADED notice
I turned off all additional extensions and disabled front-end image tab in k2 settings. Save() function still try to get $image element and with disabled image tab error show. The only solution I found out is to add if(!empty($image)) check.
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
7 years 7 months ago #161409
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic K2 image upload: hide K2_IMAGE_WAS_NOT_UPLOADED notice
Which version of K2 are you using?
If I can replicate it then I will add your edit in the repo.
If I can replicate it then I will add your edit in the repo.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Szymon Pluta
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 26
7 years 7 months ago #161412
by Szymon Pluta
Replied by Szymon Pluta on topic K2 image upload: hide K2_IMAGE_WAS_NOT_UPLOADED notice
I'm using k2 v2.7.1.
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
7 years 7 months ago #161491
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic K2 image upload: hide K2_IMAGE_WAS_NOT_UPLOADED notice
Can you send me your edit?
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Szymon Pluta
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 26
7 years 7 months ago #161508
by Szymon Pluta
Replied by Szymon Pluta on topic K2 image upload: hide K2_IMAGE_WAS_NOT_UPLOADED notice
There you Go.
location: administrator/components/com_k2/models/item.php line 276
location: administrator/components/com_k2/models/item.php line 276
if (($files['image']['error'] == 0 || $existingImage) && !JRequest::getBool('del_image'))
{
if (!empty($image)){ //added check if $image is empty
if ($files['image']['error'] == 0)
{
$image = $files['image'];
}
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['image']['error'] == 0)
$handle->Clean();
}
else
{
$mainframe->enqueueMessage(JText::_('K2_IMAGE_WAS_NOT_UPLOADED'), 'notice');
}
}// end check if $image is empty
}
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
7 years 7 months ago #161516
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic K2 image upload: hide K2_IMAGE_WAS_NOT_UPLOADED notice
Thanks Buddy :)
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- lcemk
- Offline
- New Member
Less
More
- Posts: 1
7 years 1 month ago #164617
by lcemk
Replied by lcemk on topic K2 image upload: hide K2_IMAGE_WAS_NOT_UPLOADED notice
Hello guys,
I'm having a similar issue also with 2.7.1 version.
I check the code Szymon Pluta leave it here but iam not sure what to update. After line 276 should i replace evrything for his code?
Thanks
I'm having a similar issue also with 2.7.1 version.
I check the code Szymon Pluta leave it here but iam not sure what to update. After line 276 should i replace evrything for his code?
Thanks
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
7 years 1 month ago #164627
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic K2 image upload: hide K2_IMAGE_WAS_NOT_UPLOADED notice
Can you try updating to 2.8?
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Forum
- K2 Community Forum
- English K2 Community
- K2 image upload: hide K2_IMAGE_WAS_NOT_UPLOADED notice