Keyword

Reduce the size of image-k2 folder

  • stavroch
  • stavroch's Avatar Topic Author
  • Offline
  • Elite Member
More
14 years 6 days ago #88691 by stavroch
Reduce the size of image-k2 folder was created by stavroch
Can I reduce the size of images from k2 folder? The size of this folder now is 500MB.

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

More
14 years 6 days ago #88692 by william white
Replied by william white on topic Reduce the size of image-k2 folder
I havent tried it, but if you are not using any of the say xl images, you could
Add item with image - it generates several - go an delete the xl image and
test to see if everything works ok
If you change the image or call for a size thats not there there would be some sort of error im sure
there may also be a source image you can delete...
you might try just mkdir and mv a couple of files to another dir nearby and test

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

  • stavroch
  • stavroch's Avatar Topic Author
  • Offline
  • Elite Member
More
14 years 6 days ago #88693 by stavroch
Replied by stavroch on topic Reduce the size of image-k2 folder
Yes, I have define on xl images 610px but I am not using the xl on my site. So as I can understand it generate automatically the 610px images instead of I am not using it. If I will delete the folder xl and the 610 on the admin page will still generate such a files? Can I reduce more the size of images of 500MB?

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

More
13 years 11 months ago #88694 by Lefteris
Replied by Lefteris on topic Reduce the size of image-k2 folder
Hi. K2 creates images for all sizes when you save the item. Unfortunately the only things you can do is manually drop the image sizes you do not need or try to reduce the image quality setting under K2 global parameters. Note that changing this parameter will only affect your new images not the existing ones. Thanks.



Stavros said:Yes, I have define on xl images 610px but I am not using the xl on my site. So as I can understand it generate automatically the 610px images instead of I am not using it. If I will delete the folder xl and the 610 on the admin page will still generate such a files? Can I reduce more the size of images of 500MB?

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

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

  • stavroch
  • stavroch's Avatar Topic Author
  • Offline
  • Elite Member
More
13 years 11 months ago #88695 by stavroch
Replied by stavroch on topic Reduce the size of image-k2 folder
It will be nice if you will not type anything on the XL text field of the admin page then the k2 will not create that files.

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

  • Miltiadis bouchalakis
  • Miltiadis bouchalakis's Avatar
  • Offline
  • Junior Member
More
13 years 11 months ago #88696 by Miltiadis bouchalakis
Replied by Miltiadis bouchalakis on topic Reduce the size of image-k2 folder
just an idea. try to hack the core files and remove the xl option or other options you don't use

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

  • stavroch
  • stavroch's Avatar Topic Author
  • Offline
  • Elite Member
More
13 years 11 months ago #88697 by stavroch
Replied by stavroch on topic Reduce the size of image-k2 folder
How can I do this?

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

  • Miltiadis bouchalakis
  • Miltiadis bouchalakis's Avatar
  • Offline
  • Junior Member
More
13 years 11 months ago #88698 by Miltiadis bouchalakis
Replied by Miltiadis bouchalakis on topic Reduce the size of image-k2 folder
Stavros said:How can I do this?

although i didn't know the answer i found it
i hope this will work somehow
go to joomlaroot\administrator\components\com_k2\models\item.php and comment the image sizes that you don't want
From line 192
for example not to generate the original image comment this


//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';
*/
i hope this will work somehow from what i saw the preview of the img didn't work in the admin inside the edit item when it comes to the image tab

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

More
13 years 11 months ago #88699 by Jakub Jedynak
Replied by Jakub Jedynak on topic Reduce the size of image-k2 folder
How to add extra disabled size option in K2 Options menu (lines numbers for v 2.3).

I. File "administrator/components/com_k2/config.xml"

CHANGE (line 12):

<param menu="hide" name="imagesQuality" type="text" default="100" size="4" label="Quality (%) used when processing images" description="" />

TO:

<param menu="hide" name="imagesQuality" type="text" default="100" size="4" label="Quality (%) used when processing images" description="" />
<param menu="hide" name="@spacer" type="spacer" default="" label="" description="" />
<param menu="hide" name="xs_size" type="radio" default="1" label="Use XSmall Images" description="">
<option value="0">No</option>
<option value="1">Yes</option>
</param>
<param menu="hide" name="s_size" type="radio" default="1" label="Use Small Images" description="">
<option value="0">No</option>
<option value="1">Yes</option>
</param>
<param menu="hide" name="m_size" type="radio" default="1" label="Use Medium Images" description="">
<option value="0">No</option>
<option value="1">Yes</option>
</param>
<param menu="hide" name="l_size" type="radio" default="1" label="Use Large Images" description="">
<option value="0">No</option>
<option value="1">Yes</option>
</param>
<param menu="hide" name="xl_size" type="radio" default="1" label="Use XLarge Images" description="">
<option value="0">No</option>
<option value="1">Yes</option>
</param>
<param menu="hide" name="@spacer" type="spacer" default="" label="" description="" />

II. File ""administrator/components/com_k2/models/item.php"

CHANGE (from line 204)

//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);


TO:

if ($params->get('xl_size', '1')) {
//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);
}
if ($params->get('l_size', '1')) {
//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);
}
if ($params->get('m_size', '1')) {
//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);
}
if ($params->get('s_size', '1')) {
//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);
}
if ($params->get('xs_size', '1')) {
//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);
}



III. File "administrator/components/com_k2/models/items.php"

CHANGE (from line 410)

//Source images
$sourceImage = JPATH_ROOT.DS.'media'.DS.'k2'.DS.'items'.DS.'src'.DS.md5("Image".$item->id).'.jpg';
$sourceImageXS = JPATH_ROOT.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.md5("Image".$item->id).'_XS.jpg';
$sourceImageS = JPATH_ROOT.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.md5("Image".$item->id).'_S.jpg';
$sourceImageM = JPATH_ROOT.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.md5("Image".$item->id).'_M.jpg';
$sourceImageL = JPATH_ROOT.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.md5("Image".$item->id).'_L.jpg';
$sourceImageXL = JPATH_ROOT.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.md5("Image".$item->id).'_XL.jpg';

TO:

//Source images
$sourceImage = JPATH_ROOT.DS.'media'.DS.'k2'.DS.'items'.DS.'src'.DS.md5("Image".$item->id).'.jpg';
if ($params->get('xs_size', '1')) {$sourceImageXS = JPATH_ROOT.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.md5("Image".$item->id).'_XS.jpg';}
if ($params->get('s_size', '1')) {$sourceImageS = JPATH_ROOT.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.md5("Image".$item->id).'_S.jpg';}
if ($params->get('m_size', '1')) {$sourceImageM = JPATH_ROOT.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.md5("Image".$item->id).'_M.jpg';}
if ($params->get('l_size', '1')) {$sourceImageL = JPATH_ROOT.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.md5("Image".$item->id).'_L.jpg';}
if ($params->get('xl_size', '1')) {$sourceImageXL = JPATH_ROOT.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.md5("Image".$item->id).'_XL.jpg';}


IV. File "administrator/language/en-GB/en-GB.com_k2.ini"

ADD (at the end of file)

/* use illustrations */
USE XSMALL IMAGES=Use X-Small Images
USE SMALL IMAGES=Use Small Images
USE MEDIUM IMAGES=Use Medium Images
USE LARGE IMAGES=Use Large Images
USE XLARGE IMAGES=Use X-Large Images

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

  • stavroch
  • stavroch's Avatar Topic Author
  • Offline
  • Elite Member
More
13 years 7 months ago #88700 by stavroch
Replied by stavroch on topic Reduce the size of image-k2 folder
Have you tested?

Can I delete the current files? Now the size of this folder is more than 1,5 GB

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


Powered by Kunena Forum