- Posts: 11
COMMUNITY FORUM
want to use original image in item image
- MB
- Topic Author
- Offline
- New Member
Less
More
8 years 2 months ago #157406
by MB
want to use original image in item image was created by MB
Hi JoomlaWorks,
As I know..
Image in K2 are stored in two folders:
/media/k2/items/cache (all generated sizes)
/media/k2/items/src (original image)
So, I have tried to use original image that upload via "item image" tab. This is my coding..But, I just find out the images inside "/src/" folder are not the real original images. The quality and file size are not the same that I have uploaded. Is there some setting that to use original image ? or even change K2 code to keep the real original images in "src"?
I have some reasons to use the image in "item image" not from in the "content" one.
Thank you so much for your great extension and support :)
As I know..
Image in K2 are stored in two folders:
/media/k2/items/cache (all generated sizes)
/media/k2/items/src (original image)
So, I have tried to use original image that upload via "item image" tab. This is my coding..
<?php echo JURI::base(true).'/media/k2/items/src/'.md5("Image".$this->item->id).'.jpg'; ?>
I have some reasons to use the image in "item image" not from in the "content" one.
Thank you so much for your great extension and support :)
Please Log in or Create an account to join the conversation.
- MB
- Topic Author
- Offline
- New Member
Less
More
- Posts: 11
8 years 2 months ago #157408
by MB
Replied by MB on topic want to use original image in item image
I have research a lot of topics from here and I know more people want the same I need. And If it cannot do that, I will try to use extraFields. Thank you guys.
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
8 years 2 months ago #157414
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic want to use original image in item image
Hello,
There is a solution which requires hacking K2 (I would not recommend this)
www.gavick.com/forums/general-discussion/seo-k2-image-18208
You can use an extension called econa www.firecoders.com/extensions/econa
Or you can use an extrafield in order to preserve the original image.
Some template tweaks are needed but you get a starting point here:
github.com/kricore/Advanced-templating-with-K2/blob/master/_inc/cheatsheet.php#L77-L82
There is a solution which requires hacking K2 (I would not recommend this)
www.gavick.com/forums/general-discussion/seo-k2-image-18208
You can use an extension called econa www.firecoders.com/extensions/econa
Or you can use an extrafield in order to preserve the original image.
Some template tweaks are needed but you get a starting point here:
github.com/kricore/Advanced-templating-with-K2/blob/master/_inc/cheatsheet.php#L77-L82
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- MB
- Topic Author
- Offline
- New Member
Less
More
- Posts: 11
8 years 2 months ago #157419
by MB
Replied by MB on topic want to use original image in item image
Hi Krikor,
Thank you I really appreciate your help. Actually, I have no problem with the file name of images. I just want to know why images in "/src/ " folder not the original image I have uploaded via 'item image' tab in backend. Images's quality and file size are not the same.
So, It means K2 have generated a new one before keep in "/src/". If you can tell me which file and function of K2 do that it would be great.
Thank you Krikor,
Thank you I really appreciate your help. Actually, I have no problem with the file name of images. I just want to know why images in "/src/ " folder not the original image I have uploaded via 'item image' tab in backend. Images's quality and file size are not the same.
So, It means K2 have generated a new one before keep in "/src/". If you can tell me which file and function of K2 do that it would be great.
Thank you Krikor,
Please Log in or Create an account to join the conversation.
- MB
- Topic Author
- Offline
- New Member
Less
More
- Posts: 11
8 years 2 months ago #157420
by MB
Replied by MB on topic want to use original image in item image
I have found the way to solve this problem by using this reference github.com/getk2/k2/pull/323/files
administrator/components/com_k2/models/item.php
by change from this..
to..
Now it is exacly the same quality and size :)
I think $handle->image_convert = 'jpg'; change the quality of image even you set $handle->jpeg_quality = 100;.
This coding may effect to something. I'm not sure. Please advice me.
administrator/components/com_k2/models/item.php
by change from this..
//Original image
$savepath = JPATH_SITE.DS.'media'.DS.'k2'.DS.'items'.DS.'src';
$handle->image_convert = 'jpg';
to..
//Original image
$savepath = JPATH_SITE.DS.'media'.DS.'k2'.DS.'items'.DS.'src';
if ($handle->image_src_type !== 'jpg') {
$handle->image_convert = 'jpg';
}
Now it is exacly the same quality and size :)
I think $handle->image_convert = 'jpg'; change the quality of image even you set $handle->jpeg_quality = 100;.
This coding may effect to something. I'm not sure. Please advice me.
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
8 years 2 months ago #157430
by Krikor Boghossian
Once executed (only if the image is of a format different than jpg) it will convert the image to a jpg.
Regardless of the $handle->jpeg_quality some detail might be lost if it is a lossless format, and keep in mind that:
will in fact increase the size of the image since GD does that when you set it to 100.
You could actually remove the check and have the default image as-is, but you will have to perform half a dozen more file_exists() which is really not that good.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic want to use original image in item image
$handle->image_convert = 'jpg';
Once executed (only if the image is of a format different than jpg) it will convert the image to a jpg.
Regardless of the $handle->jpeg_quality some detail might be lost if it is a lossless format, and keep in mind that:
$handle->jpeg_quality = 100;
You could actually remove the check and have the default image as-is, but you will have to perform half a dozen more file_exists() which is really not that good.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- MB
- Topic Author
- Offline
- New Member
Less
More
- Posts: 11
8 years 2 months ago #157446
by MB
Replied by MB on topic want to use original image in item image
Thank you again Krikor. I will have a look.
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
8 years 2 months ago #157456
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic want to use original image in item image
You 're welcome.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.