COMMUNITY FORUM
Search Results (Searched for: change K2 item images path)
- Roland
OG:Description not populating correctly
Category: English K2 Community
<base href="- deleted the article link so it would publish this reply -" />
<meta name="rights" content="All Contents Copyright 2020, Peoria Rescue Ministries. All Rights Reserved." />
<meta name="author" content="Jonathan Rocke" />
<meta property="og:url" content="- deleted the link so it would publish this reply -" />
<meta property="og:type" content="article" />
<meta property="og:title" content="A New Look For a New Purpose" />
<meta property="og:description" content="/* PageFly Element Styles */ .kqDkLo { word-break: break-word; } .kqDkLo span { font-weight: inherit; text-decoration: inherit; } .kqDkLo i { margin-r..." />
<meta name="twitter:card" content="summary" />
<meta name="twitter:title" content="A New Look For a New Purpose" />
<meta name="twitter:description" content="/* PageFly Element Styles */ .kqDkLo { word-break: break-word; } .kqDkLo span { font-weight: inherit; text-decoration: inherit; } .kqDkLo i { margin-right: 0.3em; } .fcqzIr { position: relative; } .gs..." />
<meta name="description" content="/* PageFly Element Styles */ .kqDkLo { word-break: break-word; } .kqDkLo span { font-weight: inherit; text-decoration: inherit; } .kqDkLo i { margin-r..." />
<meta name="generator" content="Joomla! - Open Source Content Management" />
- - - - - - - - - - - - - - - - - - -
Also, it's pulling this content in ...
- - - - - - - - - - - - - - - - - - - -
{
"@context": "schema.org",
"@type": "Article",
"mainEntityOfPage": {
"@type": "WebPage",
"@id": " - deleted the article link so it would publish this reply -"
},
"url": "- deleted the article link so it would publish this reply -",
"headline": "A New Look For a New Purpose",
"datePublished": "2021-08-16 17:25:03",
"dateModified": "2021-08-16 18:44:14",
"author": {
"@type": "Person",
"name": "Jonathan Rocke",
"url": "- deleted the link so it would publish this reply -"
},
"publisher": {
"@type": "Organization",
"name": "Peoria Rescue Ministries",
"url": "www.peoriarescue.org/",
"logo": {
"@type": "ImageObject",
"name": "Peoria Rescue Ministries",
"width": "",
"height": "",
"url": "- deleted the link so it would publish this reply -"
}
},
"articleSection": "- deleted the link so it would publish this reply -",
"keywords": "",
"description": "",
"articleBody": "/* PageFly Element Styles */ .kqDkLo { word-break: break-word; } .kqDkLo span { font-weight: inherit; text-decoration: inherit; } .kqDkLo i { margin-right: 0.3em; } .fcqzIr { position: relative; } .gsdIuB { padding: var(--pf-s-lg); } @media (min-width: 992px) and (max-width: 1199px) { .gsdIuB { padding: var(--pf-s-md); } } @media (min-width: 768px) and (max-width: 991px) { .gsdIuB { padding: var(--pf-s-sm); } } @media (max-width: 767px) { .gsdIuB { padding: var(--pf-s-xs); } } .iDckyw { position: relative; } .jdLQbH { margin: 0 calc(-1 * var(--pf-s-lg)); } @media (min-width: 992px) and (max-width: 1199px) { .jdLQbH { margin: 0 calc(-1 * var(--pf-s-md)); } } @media (min-width: 768px) and (max-width: 991px) { .jdLQbH { margin: 0 calc(-1 * var(--pf-s-sm)); } } @media (max-width: 767px) { .jdLQbH { margin: 0 calc(-1 * var(--pf-s-xs)); } } .mZVAk { position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; pointer-events: none; overflow: hidden; } .cBuwhn__parallax { position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; overflow: hidden; pointer-events: none; } .cBuwhn { padding: 15px 0px; position: relative; } .kzftmY > span:last-child { line-height: inherit; display: block; margin-right: 0px !important; } #editor-dnd-wrapper .kzftmY span + span[contenteditable] { display: block; } #editor-dnd-wrapper .kzftmY span + span[contenteditable]:empty::after { display: inline; } .kzftmY ol, .kzftmY ul { list-style-position: inside; } .kzftmY blockquote { font-size: inherit; } .aevsi { display: inline-block; } .aevsi[contenteditable="true"] { user-select: text; } .aevsi { vertical-align: baseline; word-break: break-word; } .aevsi:focus { outline: none; } .aevsi::after { display: inline; } /* PageFly Styles */ @media all { .__pf .pf-98b00650-1f1b42d0 { font-weight: 500; color: rgb(255, 255, 255); } .__pf .pf-98b00650-7d8aaa30 { line-height: 26px; } .__pf .pf-98b00650-42d08b68 { color: rgb(255, 255, 255); } .__pf .pf-98b00650-ae53b622 { text-align: center; } .__pf .pf-98b00650-faa86354 { padding: 100px 0px; background-size: cover; background-repeat: no-repeat; background-image: url(www.peoriarescue.org/"{{base_url}}images/FromTheExecutiveDirector/HopeNewsSummer21/Chapel_2_SMALL.jpg"); } .__pf .pf-98b00650-8403a126 { padding-top: 0px; } } @media only screen and (max-width: 767px) { .__pf .pf-98b00650-7d8aaa30 { line-height: 22px; } .__pf .pf-98b00650-faa86354 { background-image: url(www.peoriarescue.org/"{{base_url}}images/FromTheExecutiveDirector/HopeNewsSummer21/Chapel_2_SMALL.jpg"); } } @media only screen and (min-width: 992px) and (max-width: 1199px) { .__pf .pf-98b00650-faa86354 { background-image: url(www.peoriarescue.org/"{{base_url}}images/FromTheExecutiveDirector/HopeNewsSummer21/Chapel_2_SMALL.jpg"); } } @media only screen and (min-width: 768px) and (max-width: 991px) { .__pf .pf-98b00650-faa86354 { background-image: url(- deleted the link so it would publish this reply -{{base_url}}images/FromTheExecutiveDirector/HopeNewsSummer21/Chapel_2_SMALL.jpg"); } } A New Look for A New PurposeUse this text to share information about your brand with your customers. Describe a product, share announcements, or welcome customers to your store.The photos above show our recently renovated chapel at our Downtown Men’s Facility. And while the pictures do a pretty good job capturing the new look and feel of the chapel, I want to invite you to stop in and see it personally. Our evening Chapel Services (7:30 pm) are open to anyone or feel free to stop in and ask to see it anytime. The renovation includes new flooring, paint, furniture, and new technology, featuring high-quality video and sound capabilities. You might also notice our pallet feature wall and the pallet canvases upon which we have painted our scripture verses. The pallet wood comes from our Victory Acres Enterprise Program, where we partner with Caterpillar to recycle wood waste and rebuild pallets for them. Of course, one thing that hasn’t changed is the centrality of the cross and the gospel. But we didn’t just renovate the chapel because it needed to be updated (which it did, by the way). We renovated and modernized it for a specific purpose. You have heard us talk of wanting to continually move from a “transactional” approach to a more “relational” approach, and the chapel renovation is another step in that direction. A transactional approach might be understood as doing something to or for someone, whereas a relational approach is doing something with someone. Jesus came to be with us. That’s why one of his names is Emmanuel – God with us. It is by being with us, being in relationship with us, that Jesus saves us. The cross at center stage was given to PRM decades ago and is a constant reminder that Jesus is the only way for any of us to move from poverty to flourishing. The photos on the next page show our recently renovated chapel at our Downtown Men’s Facility. And while the pictures do a pretty good job capturing the new look and feel of the chapel, I want to invite you to stop in and see it personally. Our evening Chapel Services (7:30 pm) are open to anyone or feel free to stop in and ask to see it anytime. We wanted our chapel and the gospel-centered services we hold there to be more relational as well, and these changes help us to that. We are now able to invite Churches and groups to come and share not only gospel-centered preaching but also gospel-centered worship and fellowship. The new sound and video technology allow us to have live worship bands leading us in praising and worshipping Jesus together. The new (cleanable) floor will enable us to share dessert or refreshments to spend time together and build relationships that can truly transform lives. If your Church or even your Small Group would like to learn more about how you can join us in sharing gospel-centered worship, preaching, and fellowship WITH us – please give Lee Burnham a call at 309-676-6416. Finally, thank you. Without your gracious gifts of support, this renovation wouldn’t have happened, and we couldn’t continue to invest in a more relational, life on life approach that is “creating pathways out of poverty through Jesus with our neighbors in need."
}
And this as well,
<div class="itemFullText"> <style>/* PageFly Element Styles */
- - - - - - -
I am using JoomlaShine's Pagebuilder 4 for this and many other pages in K2. The use of Pagebuilder in Joomla articles produces correct content, but for the blogging section that I wanted to use K2 for, it keeps injecting the Pagefly section as a description for the page and I cannot figure out why.
Any suggestions (short of not using JoomlaShine's Pagebuilder products, LOL) would be helpful.
- Philippe PAVANS
k2 and image resizing landscape or portrait...
Category: English K2 Community
very proud to say : all by myself !
3 files to modified :
in administrator\components\com_k2\models\item.php
look for :
// 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_y = $imageWidth; $handle->Process($savepath);
and you have to change it to :
// Large image $handle->image_resize = true; $handle->image_ratio = 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->image_y = $imageWidth; $handle->Process($savepath);
you have to do that for every size setting XL L S XS etc...
then
components\com_k2\templates\default\item.php
to lok for :
<!-- Item Image --> <div class="itemImageBlock"> <span class="itemImage"> <a data-k2-modal="image" href="<?php echo $this->item->imageXLarge; ?>" title="<?php echo JText::_('K2_CLICK_TO_PREVIEW_IMAGE'); ?>"> <img src="<?php echo $this->item->image; ?>" alt="<?php if(!empty($this->item->image_caption)) echo K2HelperUtilities::cleanHtml($this->item->image_caption); else echo K2HelperUtilities::cleanHtml($this->item->title); ?>" style="width:<?php echo $this->item->imageWidth; ?>px; height:auto;" /> </a> </span>
suppression of "style" in img
change it for :
<!-- Item Image --> <div class="itemImageBlock"> <span class="itemImage"> <a data-k2-modal="image" href="<?php echo $this->item->imageXLarge; ?>" title="<?php echo JText::_('K2_CLICK_TO_PREVIEW_IMAGE'); ?>"> <img src="<?php echo $this->item->image; ?>" alt="<?php if(!empty($this->item->image_caption)) echo K2HelperUtilities::cleanHtml($this->item->image_caption); else echo K2HelperUtilities::cleanHtml($this->item->title); ?>" /> </a> </span>
components\com_k2\templates\default\latest-item.php
you look for :
<!-- Item Image --> <div class="latestItemImageBlock"> <span class="latestItemImage"> <a href="<?php echo $this->item->link; ?>" title="<?php if(!empty($this->item->image_caption)) echo K2HelperUtilities::cleanHtml($this->item->image_caption); else echo K2HelperUtilities::cleanHtml($this->item->title); ?>"> <img src="<?php echo $this->item->image; ?>" alt="<?php if(!empty($this->item->image_caption)) echo K2HelperUtilities::cleanHtml($this->item->image_caption); else echo K2HelperUtilities::cleanHtml($this->item->title); ?>" style="width:<?php echo $this->item->imageWidth; ?>px;height:auto;" /> </a> </span> <div class="clr"></div> </div>
suppression of "style" in img
<!-- Item Image --> <div class="latestItemImageBlock"> <span class="latestItemImage"> <a href="<?php echo $this->item->link; ?>" title="<?php if(!empty($this->item->image_caption)) echo K2HelperUtilities::cleanHtml($this->item->image_caption); else echo K2HelperUtilities::cleanHtml($this->item->title); ?>"> <img src="<?php echo $this->item->image; ?>" alt="<?php if(!empty($this->item->image_caption)) echo K2HelperUtilities::cleanHtml($this->item->image_caption); else echo K2HelperUtilities::cleanHtml($this->item->title); ?>" /> </a> </span> <div class="clr"></div> </div>
as we say in french : " OUF !....."
translation : " It's such a relief !!!"
You can do the same operation for others image upload forms of k2 as categorie image and avatar...
- Thomas Brown
K2 Import/associate +10k Images
Category: English K2 Community
Basically it sounds like I need to set the path in the introtext then some how change the file names to Image."itemID" - move those images to the media/K2/items/src directory - then run the rebuild Image Cache. Then remove the <img> tag from the introtext. Is this what you are saying?
- JoomlaWorks
Cache Problem in K2
Category: English K2 Community
What you need to do is enable the option "Force 'item modified date' as URL timestamp on image paths" in the "Images" tab of the K2 component settings.
- JoomlaWorks
Og:image Width and Height
Category: English K2 Community
<?php // no direct access defined('_JEXEC') or die; // Get the image and its dimensions if($this->item->params->get('itemImage') && !empty($this->item->image)) { $basename = basename($this->item->image); if (strpos($basename, '?t=')!==false) { $tmpBasename = explode('?t=', $basename); $basenameWithNoTimestamp = $tmpBasename[0]; } else { $basenameWithNoTimestamp = $basename; } $imagePathOnSystem = JPATH_SITE.'/media/k2/items/cache/'.$basenameWithNoTimestamp; if (JFile::exists($imagePathOnSystem)) { list($width, $height) = getimagesize($imagePathOnSystem); $document = JFactory::getDocument(); $document->setMetaData('og:image:width', $width); $document->setMetaData('og:image:height', $height); } }
- Al Parcs
Category images and cdn
Category: English K2 Community
I'm using AWS Cloudfront as cdn, I enabled "Force 'item modified date' as URL timestamp on image paths" in K2 parameters, but when I change a category image I can see the new one on backend, but not on frontend. I cleaned different browsers cache, still can't see the change after almost 24hours.
Do you have any idea?
Thank you
- Klaus Veliu
Customize K2 image logic administrator area.
Category: English K2 Community
After using K2 for many years to manage the content of the Joomla websites I feel comfortable using it.
In this case, I am using Joomla just to manage the content from the administrators,
the frontend is being served from a custom coded PHP website.
The current logic of K2 that creates 5 images for each article bothers me a lot, I can delete all the files in
media/k2/items/cache/ but this will result in not showing images on Administrator area and confusing the users.
It is possible to override the K2 component logic to retain the changes even after a component update and call the original image stored in this path media/k2/items/src/ in every image section?!
Thank you!
- Syed Raza Naqvi
k2 to com_content Issue
Category: English K2 Community
I have more than 32,000 items , problem is when I started web site I have changed k2 core how image was renamed with watermark.
I used below code to save images without md5:
$handle->file_new_name_body = $row->alias.$row->id; .md5("Image".$row->id). change to .$row->alias.$row->id. md5("Image".$current->id) change to .$row->alias.$row->id. .md5("Image".$item->id). change to .$row->alias.$row->id. .md5("Image".$news_id). change to .$row->alias.$row->id.
Now I am migrating to WordPress and when converting items to content....Images can not be transferred to content even FG joomla is unable to import k2 images, and JA plugin k2 to content migration plugin also failed. in plugin I am using following code;
/** * Get the featured image * * @param int $item_id Item ID * @return string Image name */ private function get_featured_image($item_id) { $found_image_name = ''; [b]$image_md5 = ("p.alias" . $item_id);[/b] // Try to get the original image in the src folder $image_name = 'media/k2/items/src/' . $image_md5 . '.jpg'; $image_url = trailingslashit($this->plugin->plugin_options['url']) . $image_name; if ( $this->plugin->url_exists($image_url) ) { $found_image_name = $image_name; } else { // if the featured image doesn't exist in the src folder, try to get the XL image in the cache folder $image_name = 'media/k2/items/cache/' . $image_md5 . '_XL.jpg'; $image_url = trailingslashit($this->plugin->plugin_options['url']) . $image_name; if ( $this->plugin->url_exists($image_url) ) { $found_image_name = $image_name; } } return $found_image_name; }
or
private function _convertK2Items($batch = 50) { $k2items = $this->fetchItems($batch); // select items with cat and extra fields condition. $numItems = count($k2items); if (!$numItems) { return 0; } $qi_q = 'INSERT INTO #__content_meta (id, content_id, meta_key, meta_value , encoded) VALUES '; $qi_v = array(); $count=0; foreach ($k2items AS $k => $v) { $tags = array(); $assoc = $this->checkAssociation($v->id, 'item'); if (!$assoc) { // Copy Image from K2. if (JFile::exists(JPATH_ROOT . '/media/k2/items/src/' . 'alias' . $v->id . '.jpg')) { JFolder::create(JPATH_ROOT . '/images/joomlart/article/'); // create recusive folder. copy('../media/k2/items/src/' . 'alias' . $v->id . '.jpg', '../images/joomlart/article/' . 'alias' . $v->id . '.jpg'); $images = array( 'image_intro' => 'images/joomlart/article/' . 'alias' . $v->id . '.jpg', 'float_intro' => '', 'image_intro_alt' => $v->image_caption, 'image_intro_caption' => $v->image_credits, 'image_fulltext' => 'images/joomlart/article/' . 'alias' . $v->id . '.jpg', 'float_fulltext' => '', 'image_fulltext_alt' => $v->image_caption, 'image_fulltext_caption' => $v->image_credits ); $images = json_encode($images); } else $images = ''; // Convert Tag id from k2 to new id. if ($v->tags_id != NULL) { $tags_id = explode(',', $v->tags_id); foreach ($tags_id AS $tg) { $tag = $this->checkAssociation($tg, 'tag'); if($tag) { $tags[] = $tag->key; } } }
- Miroslav Ernst
k2 v 2.8.0
Category: English K2 Community
However, in my opinion, the installation / update process K2 would have to delete these shifted / unnecessary files!
- Dean
Tool for importing / exporting items to / from K2
Category: English K2 Community
K2 V 2.7.1
K2Import Tool com_k2import_2.5.BETA.2
Never mind I figured it out. Things have changed since K2 v2.7...I just needed to add the path for a windows server.
- Odin Mayland
Attachment link shows "File does not exist"
Category: English K2 Community
It had the same url structure as the other one: /index.php?option=com_k2&view=item&task=download&id=76_48b65d31ad1d315cbe90fcdf9f0763d0
So it doesn't appear to be a bug with k2.
****
I think it has to do with changing the "Change root attachments folder" to "../images/podcasts"
Do you see an issue with my path?
The reason I did this was so the user could select the same mp3 in the k2 media tab using the "Browse media on server".
- Rob
Read More breaks HTML formatting
Category: English K2 Community
Krikor wrote: You can remove all the introtext's (.itemIntrotext) styling from the k2.css file.
Remember to override the k2.css file.
Copy it from the /components/com_k2/css/ folder and paste it to your template's /css folder.
One thing to add is to make sure to change the relative paths listed in k2.css for the various image files to match where k2.css is moved to. Before doing this the first thing I noticed was that the rating star images disappeared.
for example from this:
.itemRatingList .itemCurrentRating {background:transparent url(../images/system/transparent_star.gif) left -1000px repeat-x;}
To this:
.itemRatingList .itemCurrentRating {background:transparent url(../../../components/com_k2/images/system/transparent_star.gif) left -1000px repeat-x;}
-Rob
- Suthu
Fehler im Backend
Category: Offizielle deutsche Gemeinschaft
wenn ich im Backend K2 Kategorien auswähle, erhalte ich auf einer weißen Seite folgende Fehlermeldung:
Notice: Undefined variable: db in /www/htdocs/.../administrator/components/com_k2/models/category.php on line 167
Fatal error: Call to a member function setQuery() on null in /www/htdocs/.../administrator/components/com_k2/models/category.php on line 167
Joomla!-Version 3.5.1
K2 v2.7.0
PHP-Version 5.6.21-nmm1
<?php /** * @version 2.7.x * @package K2 * @author JoomlaWorks https://www.joomlaworks.net * @copyright Copyright (c) 2006 - 2016 JoomlaWorks Ltd. All rights reserved. * @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html */ // no direct access defined('_JEXEC') or die; jimport('joomla.application.component.model'); JTable::addIncludePath(JPATH_COMPONENT.DS.'tables'); class K2ModelCategory extends K2Model { function getData() { $cid = JRequest::getVar('cid'); $row = JTable::getInstance('K2Category', 'Table'); $row->load($cid); return $row; } function save() { $mainframe = JFactory::getApplication(); jimport('joomla.filesystem.file'); require_once (JPATH_COMPONENT.DS.'lib'.DS.'class.upload.php'); $row = JTable::getInstance('K2Category', 'Table'); $params = JComponentHelper::getParams('com_k2'); if (!$row->bind(JRequest::get('post'))) { $mainframe->enqueueMessage($row->getError(), 'error'); $mainframe->redirect('index.php?option=com_k2&view=categories'); } $isNew = ($row->id) ? false : true; //Trigger the finder before save event $dispatcher = JDispatcher::getInstance(); JPluginHelper::importPlugin('finder'); $results = $dispatcher->trigger('onFinderBeforeSave', array('com_k2.category', $row, $isNew)); $row->description = JRequest::getVar('description', '', 'post', 'string', 2); if ($params->get('xssFiltering')) { $filter = new JFilterInput( array(), array(), 1, 1, 0); $row->description = $filter->clean($row->description); } if (!$row->id) { $row->ordering = $row->getNextOrder('parent = '.(int)$row->parent.' AND trash=0'); } if (!$row->check()) { $mainframe->enqueueMessage($row->getError(), 'error'); $mainframe->redirect('index.php?option=com_k2&view=category&cid='.$row->id); } if (!$row->store()) { $mainframe->enqueueMessage($row->getError(), 'error'); $mainframe->redirect('index.php?option=com_k2&view=categories'); } if (!$params->get('disableCompactOrdering')) $row->reorder('parent = '.(int)$row->parent.' AND trash=0'); if ((int)$params->get('imageMemoryLimit')) { ini_set('memory_limit', (int)$params->get('imageMemoryLimit').'M'); } $files = JRequest::get('files'); $savepath = JPATH_ROOT.DS.'media'.DS.'k2'.DS.'categories'.DS; $existingImage = JRequest::getVar('existingImage'); if (($files['image']['error'] === 0 || $existingImage) && !JRequest::getBool('del_image')) { if ($files['image']['error'] === 0) { $image = $files['image']; } else { $image = JPATH_SITE.DS.JPath::clean($existingImage); } $handle = new Upload($image); if ($handle->uploaded) { $handle->file_auto_rename = false; $handle->jpeg_quality = $params->get('imagesQuality', '85'); $handle->file_overwrite = true; $handle->file_new_name_body = $row->id; $handle->image_resize = true; $handle->image_ratio_y = true; $handle->image_x = $params->get('catImageWidth', '100'); $handle->Process($savepath); if ($files['image']['error'] === 0) $handle->Clean(); } else { $mainframe->enqueueMessage($handle->error, 'error'); $mainframe->redirect('index.php?option=com_k2&view=categories'); } $row->image = $handle->file_dst_name; } if (JRequest::getBool('del_image')) { $currentRow = JTable::getInstance('K2Category', 'Table'); $currentRow->load($row->id); if (JFile::exists(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'categories'.DS.$currentRow->image)) { JFile::delete(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'categories'.DS.$currentRow->image); } $row->image = ''; } if (!$row->store()) { $mainframe->enqueueMessage($row->getError(), 'error'); $mainframe->redirect('index.php?option=com_k2&view=categories'); } //Trigger the finder after save event $dispatcher = JDispatcher::getInstance(); JPluginHelper::importPlugin('finder'); $results = $dispatcher->trigger('onFinderAfterSave', array('com_k2.category', $row, $isNew)); $cache = JFactory::getCache('com_k2'); $cache->clean(); switch(JRequest::getCmd('task')) { case 'apply' : $msg = JText::_('K2_CHANGES_TO_CATEGORY_SAVED'); $link = 'index.php?option=com_k2&view=category&cid='.$row->id; break; case 'saveAndNew' : $msg = JText::_('K2_CATEGORY_SAVED'); $link = 'index.php?option=com_k2&view=category'; break; case 'save' : default : $msg = JText::_('K2_CATEGORY_SAVED'); $link = 'index.php?option=com_k2&view=categories'; break; } $mainframe->enqueueMessage($msg); $mainframe->redirect($link); } function countCategoryItems($catid, $trash = 0) { $query = "SELECT COUNT(*) FROM #__k2_items WHERE catid={$catid} AND trash = ".(int)$trash; $db->setQuery($query); $result = $db->loadResult(); $dispatcher = JDispatcher::getInstance(); JPluginHelper::importPlugin ('k2'); $additional_category_links=$dispatcher->trigger('onK2BeforeCountCategoryItemsAdmin', array(&$result,$catid,$trash)); $db = JFactory::getDBO(); $catid = (int)$catid; $query = "SELECT COUNT(*) FROM #__k2_items WHERE catid={$catid} AND trash = ".(int)$trash; $db->setQuery($query); $result = $db->loadResult(); return $result; } }
Kann mir bitte jemand weiterhelfen - Danke
- Krikor Boghossian
change item image not working properly
Category: English K2 Community
Under K2's parameters -> image tab there is a setting called "Force 'item modified date' as URL timestamp on image paths".
If you enable it, it will enforce a new url (with a timestamp) for these images.
- by Alexander
K2 extra field image as header in article
Category: English K2 Community
I want to have a custom header image for each item. By default, header articles, when using a category overview with articles and their thumbnail images, use the same image. Only the L or XL version. I want to use an extra field image where my client can choose his own image for the article header itself, not the thumbnail. That needs to stay connected to the default function like it works now.
What I did:
I made an extra field > IMAGE for a category.
I used a template from Gavick which already made their own sub template.
I copied that default folder name to my desktop, changed the name to "projects" and then uploaded it back into templates/gk_technews/html/com_k2/templates/projects"
Inside each category I changed the template for the category item layout to "projects".
once done I open item.php file from the "projects" folder. Now I see at line 64 some code that reflects the header image by default.
My question. To what do I need to change this below code to have it use the custom image selected path for a server folder? I use the following path.
/*root*/images/*clientname*/projects/
I would think that my client will need to upload each project image for his header inside this folder. When done, he can select it with the "select" button inside the K2 extra field image tab.
I'm not a php programmer. I can read it a bit, but thats about it. MAybe someone can point me out how to connect the 2. Is there a variable or something that is explicitly used for extra field images being shown?
<div class="header">
<div class="header-wrap<?php if(empty($this->item->image)) : ?> no-image<?php endif; ?>">
<?php if(!empty($this->item->image)) : ?>
<img src="<?php echo str_replace('_L.jpg', '_XL.jpg', $this->item->image); ?>" alt="<?php echo K2HelperUtilities::cleanHtml($this->item->title); ?>" />
<?php endif; ?>
- Alex
K2 different Image and Attatchment Path
Category: English K2 Community
Lefteris wrote: The browse server button used in K2 images and attachments is always looking at the path you set System Configuration -> Media . This option is common for every place that media manager is used in K2.
Hi, thank you for your response Lefteris,
my intention is, to upload image and pdf attatchment via ftp. And by time, if i want to change the attatchment, i want to replace the file on the ftp. So that i dont have to remove and add it new in the k2 item interface in joomla. Do you know what i mean?
Does it work, that i save my attatchments in "media/k2/attatchments" and my images in "media/k2/items/src" and it will work like i need?
I doesnt think so, becaus if i use an attatment in different items, they get copyed and renamed wit item id in front of attatchment name.
Someone got a solution for this, or how do i controll the images/attatchmens comfortable?
- Lefteris
K2 different Image and Attatchment Path
Category: English K2 Community
K2 images are always stored under media/k2/items and this cannot be changed.
K2 attachments are stored in the path you set in the K2 parameters in the option "Change root attachments folder" .
The browse server button used in K2 images and attachments is always looking at the path you set System Configuration -> Media . This option is common for every place that media manager is used in K2.
- Alex
K2 different Image and Attatchment Path
Category: English K2 Community
I want to attatch one pdf file and one jpg image to my k2 item.
I upload the pdfs via ftp to the folder "media/k2/attatchments/pdf/en" and u upload the images to "images/k2items".
Now i add one of each in my k2 item using k2 in joomla.
Somehow the pdfs get copyed to "media/k2/attatchments" even i have them already online in the folder above.
And the images gets copyed into "media/k2/items/src". And i think k2 uses them from there.
Why cant k2 use it from my folder, where i choose them?
If i change a pdf local and replace it in my folder "media/k2/attatchments/pdf/en", then i think i wont replaced on the webpace, because it holdes the backup in "media/k2/attatchments".
Guess i have to delate it in my k2 item and add id again.
Cann someone help me to get rid of this?
- Peer
Tool for importing / exporting items to / from K2
Category: English K2 Community
i followed the instructions from gavick.com mentioned in the following post to use the item alias within the image name.
www.gavick.com/forums/general-discussion/seo-k2-image-18208
I changed all recent files according to the following instructions:
$handle->file_new_name_body = $row->alias.$row->id; .md5("Image".$row->id). change to .$row->alias.$row->id. md5("Image".$current->id) change to $current->alias.$current->id; .md5("Image".$item->id). change to .$item->alias.$item->id. .md5("Image".$news_id). change to .$news_alias.$news_id.
Actually I'm trying to change your "k2import.php" which is the only script I found to handle the images.
on line 865: $handle->file_new_name_body = md5("Image".$this->_k2_item_id);
on line 1138: $image_name = $image_savepath . md5("Image".$items[$item_count]->id) . ".jpg";
Everything I do, I dont get the alias placed within the imagename. May you give me a hint how to appropriate change the code for my needs?
many thanks in advance
Peer
- Cydonian
[SOLVED] K2 image cache rebuild
Category: English K2 Community
.
Since I have more than 1000 items having an image in my K2 web site, K2 produces 1000x6 (_Generic.jpg, _XS.jpg, _S.jpg, _M.jpg, _L.jpg, _XL.jpg for each main image of each K2 item) different resized images in total, I ended up with 6000 images and since there is a 2000-file limit for each folder (in this case, it is /media/k2/items/cache/ folder) on my hosting service, I had to divide the cache folder into 6 subfolders to keep 6000 K2 images.
So I created these, folders with ftp software on my hosting :
/media/k2/items/cache/Generic/ ( to create 1000 _Generic.jpg images under this folder)
/media/k2/items/cache/XS/ ( to create 1000 _XS.jpg images under this folder)
/media/k2/items/cache/S/ ( to create 1000 _S.jpg images under this folder)
/media/k2/items/cache/M/ ( to create 1000 _M.jpg images under this folder)
/media/k2/items/cache/L/ ( to create 1000 _L.jpg images under this folder)
/media/k2/items/cache/XL/ ( to create 1000 _XL.jpg images under this folder)
So I uploaded rebuild.php to /media/k2/items/ folder and run it by typing www.mysite.com/media/k2/items/rebuild.php on my browser's address bar and it displayed a 113 lines code so I copy and pasted that 113 lines code to notepad++ and changed code to produce 1000 of _Generic.jpg images under /media/k2/items/cache/Generic/ from 1000 source images under /media/k2/items/src/
Here is the changed code of of 113 lines to produce it:
<?php /** * How to use: * * 1) Copy this file as rebuild.php into "JPATH_ROOT/media/k2/items" * 2) Check Variables, use a size of 0 for not processing this image size * 3) run it "php -f rebuild.php" (it overwrites existing files without notice) * * @author Robert Deutz <[email protected]> */ // Variabels $sizeG = 300; $sizeL = 600; $sizeM = 300; $sizeS = 200; $sizeXL = 900; $sizeXS = 100; $jpeg_quality = 90; /** * DO NOT CHANGE ANYTHING AFTER THIS LINE IF YOU DON'T KNOW WHAT YOU ARE DOING! */ $uploadclassfile = dirname(__FILE__).'/../../../administrator/components/com_k2/lib/class.upload.php'; if(!file_exists($uploadclassfile)) { echo "Can't find class.upload.php! Is K2 installed? Did you copy rebuild.php to the right directory?"; } define('_JEXEC',1); require_once ($uploadclassfile); // dirs $sourcedir = dirname(__FILE__).'/src'; $targetdir = dirname(__FILE__).'/cache/Generic/'; $sizes = array('Generic' => $sizeG); if ($fhandle = opendir($sourcedir)) { while (false !== ($entry = readdir($fhandle))) { $file = $sourcedir.'/'.$entry; if (is_file($file)) { echo '.'; $r = buildImages($file, $targetdir, $sizes, $jpeg_quality); if ($r === true) { echo "File: ".$entry . " SUCCESSFUL\n"; } else { echo "File: ".$entry . " FAIL\n"; echo "Details:\n"; foreach($sizes AS $key => $value) { $result = 'Success'; if (array_key_exists($key, $r)) { $result = 'Failed'; } echo "Size $key ($value px): ".$result."\n"; } } } } closedir($fhandle); } function buildImages($sourcefile, $targetdir, $sizes, $jpeg_quality=90) { $resultsummery = true; foreach($sizes AS $key => $value) { if ($value != 0) { $filename = basename($sourcefile,'.jpg'); $targetfile = $targetdir.'/'.$filename.'_'.$key.'.jpg'; if (buildImage($sourcefile, $targetfile, $value) !== true) { // Successful $resultdetails[$key] = true; } else { // Failed $resultsummery = false; $resultdetails[$key] = false; } } } return $resultsummery ? true : $resultdetails; } function buildImage($sourcefile, $targetfile, $size, $jpeg_quality=90) { $handle = new Upload($sourcefile); $savepath = dirname($targetfile); $handle->image_resize = true; $handle->image_ratio_y = true; $handle->image_convert = 'jpg'; $handle->jpeg_quality = $jpeg_quality; $handle->file_auto_rename = false; $handle->file_overwrite = true; $handle->file_new_name_body = basename($targetfile,'.jpg'); $handle->image_x = (int) $size; return $handle->Process($savepath); }
This solved my 2000 image limit problem of /media/k2/items/cache/ folder for now.
I also had to change some other php files like:
/administrator/components/com_k2/views/items/tmpl => default.php
line 167 => added .DS.'XL'
line 168 => added XL/
so that admin can view image of an item when he edits a previously written item because it has a new location now.
because item's old image location was: /media/k2/items/cache/
and now item's new image location is: /media/k2/items/cache/XL/
I just wanted to show you how to use rebuild.php in details when you faced a "2000 file limit" for "item image cache" folder.
I hope it helps!
P.S.: ==>>> K2 developers should find a permanent solution for big web sites including thousands of items and thousands of item images created under /media/k2/items/cache/ folder in next releases of K2 <<<==