Keyword

Resized images of K2 item to /media/k2/items/cache/SUBFOLDER

  • Cydonian
  • Cydonian's Avatar Topic Author
  • Offline
  • New Member
More
9 years 6 months ago - 9 years 6 months ago #142024 by Cydonian
When admin creates a new K2 item with an image, K2 produces 6 different sizes (_Generic.jpg, _XS.jpg, _S.jpg, _M.jpg, _L.jpg, _XL.jpg) of main image (located under /media/k2/items/src/) and put these, 6 different resized images under /media/k2/items/cache folder.

When admin creates a new K2 item with an image, I want K2 to do it in this way:
- produce 6 different sizes of main image (let's say main_image.jpg) as before BUT put each resized image under these, folders:
main_image_Generic.jpg => /media/k2/items/cache/Generic/
main_image_XS.jpg => /media/k2/items/cache/XS/
main_image_S.jpg => /media/k2/items/cache/XS/
main_image_M.jpg => /media/k2/items/cache/M/
main_image_L.jpg => /media/k2/items/cache/L/
main_image_XL.jpg => /media/k2/items/cache/XL/

I need help, which php file(s) control this action under K2 ??
And how to modify it to make K2 do that for resized item images ??
Thanks!
Last edit: 9 years 6 months ago by Cydonian. Reason: correction

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 6 months ago #142029 by Krikor Boghossian
Replied by Krikor Boghossian on topic Resized images of K2 item to /media/k2/items/cache/SUBFOLDER
I am sorry but this cannot be done.

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

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

  • Cydonian
  • Cydonian's Avatar Topic Author
  • Offline
  • New Member
More
9 years 6 months ago #142030 by Cydonian
why not?? everything is possible if you change its code :)
I just want to know which php file under k2 component controls this function...

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

More
9 years 6 months ago #142042 by Lefteris
@Cydonian

Hacking an extension is a really bad practice.

It's also not that simple as it sounds. The file that generates the images is administrator/components/com_k2/models/item.php. Changing just that will simply break the extension. You will also have to find all the points in K2 ( component, modules and plugins ) where it is fetching the images and also hack them to use the new locations.

Finally keep in mind that hacking the core K2 will have the following results:

1. Lock you out of K2 updates. Every time an update is out you will lose your changes.
2. You will not be able to get support anymore. Don't expect from us ( or any other company doing this ) to provide support on a hacked extension.
3. Lock you out of most K2 extensions. Hacking core K2 files can cause third-party K2 extensions to break.

That's what you need to know. The choice is yours.

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

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

  • Cydonian
  • Cydonian's Avatar Topic Author
  • Offline
  • New Member
More
9 years 6 months ago - 9 years 6 months ago #142047 by Cydonian
@Lefteris

Since I won't update K2 any more, it is not a problem for me.
Current K2 is not enough because it can only store 333 items' images (333x6= 1998 resized images) in cache folder when your hosting service (most of hosting companies have the similar limits) has 2000 file limit for one folder.
At the moment, I am already using 6 different subfolders (cache/XL/, cache/L/, cache/M/, cache/S/, cache/XS/, cache/Generic/) each containing 1000 resized images for my 1000 k2 items on my web site and it is working without any problems if you hack the correct files.
If I can find the correct php file and if I can make K2 put each 6 resized images into "cache/XL/, cache/L/, cache/M/, cache/S/, cache/XS/, cache/Generic/" folders when admin creates a new item with an image, then it will be finished.
I saw other K2 users asking for the similar features from K2 developers in the forum but since there is no positive response from the developers yet, users will have to fix K2 component according to their needs, so that is what I am also going to do.
Thanks for the info, I will check "administrator/components/com_k2/models/item.php" file.
Last edit: 9 years 6 months ago by Cydonian.

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


Powered by Kunena Forum