Where does k2 component store its images in the database?

吃可爱长大的小学妹 提交于 2019-11-29 13:59:50

问题


I want to retrieve/query images stored by joomla k2 component (under the Image Tab).


回答1:


To display the K2 item image you can use this

echo "media/k2/items/cache/".md5("Image".K2 ITEM ID HERE)."_XL.jpg";



回答2:


It's not stored in the database at all.

They use the md5 hash on the actual K2 item ID, and that is how they rename and save the image in the folder media/k2/items/cache/.

Anywhere the K2 item is pulled up, they use JFile::exists (which is used to check if a file exists in the path set) with the path

URL-ROOT."media/k2/items/cache/".md5("image" . K2 ITEM ID HERE)."_XL.jpg"

and if the file is there, it shows the image.

Also, the _XL.jpg will change depending on what size the image is set to display on the page, be it a thumbnail, large, XL, etc.

I know that isn't what you wanted to hear, but that is how they do it :) Hope that helps man!




回答3:


Though you got the answer sharing the info may be helpful:

If working within the K2 Templates (Html overrides) following can be used to access the image added via K2 image tab.

$this->item->image

OR

$this->item->imageXLarge (size you want)

you get relative url : /media/k2/items/cache/29642a1d30cebf98734fb424b2b1316b_L.jpg




回答4:


You can find the originals in the media/k2/items/src/ directory. Also, @David is correct, "Image" is needed as prefix to the k2 item id.



来源:https://stackoverflow.com/questions/10968380/where-does-k2-component-store-its-images-in-the-database

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!