In this forum you'll find the threads about Gary´s Cookbook 3.0 and above with extensions. English or german possible.
<
>

In diesem Forum geht´s um die Version 3.0 von Gary´s Cookbook oder neuer mit Erweiterungen. Englisch oder deutsch ist möglich.

Thumbnail selector in Backend not working

  • tophery
  • Topic Author
  • Visitor
  • Visitor
13 years 6 months ago #4272 by tophery
I am not sure why the thumbnail selector is not working properly when creating a recipe. I am uploading the image through the image manager. A thumbnail is being created, which I can verify through FTP, but when I go to create a recipe, it will only let me select a recipe image, but in the thumbnail dropdown, it seems like it is indicating that there are no images.

I am unable to even select a thumbnail for the recipe.

Also, I have already been through the backend numerous times to ensure that all paths are correct. According to the cookbook. The paths are set, its creating the thumbnails, it is the recipe manager that is not finding the thumbnails in the directory.

I tried looking through the PHP files to see if the dropdown is originating from the components/com_garyscookbook/img_thumbnails folder. I cannot find that particular code to determine this, so I am now turning to you guys.

It appears that someone else before me was having the same problem I am having now.

Please Log in to join the conversation.

More
13 years 6 months ago #4273 by over
Hi tophery,

thanks for your lines!
Normaly we do not give any advice on the code but in this case I will try to. Obviously there is a problem. Give me time untill tomorrow. I have to search the code as much much as you. I'll give the hint to the german thread as well. Hopefully you can find something.

As I wrote in german I can't reproduce the problem here on garyscookbook and not on a local MS system.

over

Please Log in to join the conversation.

  • tophery
  • Topic Author
  • Visitor
  • Visitor
13 years 6 months ago #4274 by tophery
Replied by tophery on topic Re:Thumbnail selector in Backend not working
I am still actively looking myself too. Here is what I have found so far.

In the following: administrator/components/com_garyscookbook/admin.garyscookbook.html.php

The command
<?php echo $thumblist; ?> will not generate a thumbnail listing. If you input your other commands $imagelist2, it will actually allow the dropdown in the recipe manager to work, however, it is not a thumbnail, nor will it save or preview the image. It just shows the listing.

A step in the right direction I think, but still unable to find the cause. Then again, I am unfamiliar with the code and just shooting in the dark with it.

Please Log in to join the conversation.

More
13 years 6 months ago #4277 by over
Hi,
yes you have found where to look.

Program: admin.garyscookbook.php
lines around 460 - 520

Did you add a line like this to see the paths? If these are correct you have to find out why the
selection list don't incclude any selectable files. Some kind of rights for the path?

echo ' Images: '.$GKBabsolut.'/'.$ag_pathimages.' Thumbs: '.$GKBabsolut.'/'.$ag_paththumbs;

Please Log in to join the conversation.

  • tophery
  • Topic Author
  • Visitor
  • Visitor
13 years 6 months ago #4290 by tophery
Replied by tophery on topic Re:Thumbnail selector in Backend not working
I am not exactly sure where I should be adding the lines, of if it is needed. So I am copying the code from my admin.garyscookbook.php file from lines 460 - 520. If you can help a bit with how it should look, that would be great. I am not very good with PHP. I can find things sometimes, but when it comes to writing. I am clueless.

Code:
if (count($categories) < 1) $mainframe->redirect("index2.php?option=categories&section=$option", 'You must add a category for this section first.'); //$clist = JHTML::_('select.genericlist', $categories, 'catid', 'class="inputbox" size="1"', 'value', 'text', intval( $row->catid ) ); $clist = ShowDropDownCategoryList($row->catid , 'catid', ' size="1"'); $clist2 = ShowDropDownCategoryList($row->catid2 , 'catid2', ' size="1"'); $clist3 = ShowDropDownCategoryList($row->catid3 , 'catid3', ' size="1"'); $clist4 = ShowDropDownCategoryList($row->catid4 , 'catid4', ' size="1"'); $clist5 = ShowDropDownCategoryList($row->catid5 , 'catid5', ' size="1"'); // Create Picture List $imgFiles = JFolder::files("$GKBabsolut/$ag_pathimages"); // $imgFiles = mosReadDirectory( "$GKBabsolut/$ag_pathimages" ); $images = array(JHTML::_('select.option', '', JText::_('Select Recipe Picture'))); $file=""; foreach ($imgFiles as $file) { // eregi has to be replaced. Notice with php 5.3 // if (eregi("bmp|gif|jpg|png|jpeg", $file)) { if(stristr($file, 'bmp') || stristr($file, 'gif') || stristr($file, 'jpg') || stristr($file, 'png') || stristr($file, 'jpeg')) $images[] = JHTML::_('select.option', $file); } $imagelist = JHTML::_('select.genericlist', $images, 'imgfilename', "class=\"inputbox\" size=\"1\"" . " onchange=\"javascript:if (document.forms[0].imgfilename.options[selectedIndex].value!='') {document.imagelib2.src='$GKB_Live_site/$ag_pathimages/' + document.forms[0].imgfilename.options[selectedIndex].value} else {document.imagelib2.src='../images/M_images/blank.png'}\"", 'value', 'text', $row->imgfilename); $imagelist1 = JHTML::_('select.genericlist', $images, 'expic1', "class=\"inputbox\" size=\"1\"" . " onchange=\"javascript:if (document.forms[0].expic1.options[selectedIndex].value!='') {document.expiclib1.src='$GKB_Live_site/$ag_pathimages/' + document.forms[0].expic1.options[selectedIndex].value} else {document.expiclib1.src='../images/M_images/blank.png'}\"", 'value', 'text', $row->expic1); $imagelist2 = JHTML::_('select.genericlist', $images, 'expic2', "class=\"inputbox\" size=\"1\"" . " onchange=\"javascript:if (document.forms[0].expic2.options[selectedIndex].value!='') {document.expiclib2.src='$GKB_Live_site/$ag_pathimages/' + document.forms[0].expic2.options[selectedIndex].value} else {document.expiclib2.src='../images/M_images/blank.png'}\"", 'value', 'text', $row->expic2); $imagelist3 = JHTML::_('select.genericlist', $images, 'expic3', "class=\"inputbox\" size=\"1\"" . " onchange=\"javascript:if (document.forms[0].expic3.options[selectedIndex].value!='') {document.expiclib3.src='$GKB_Live_site/$ag_pathimages/' + document.forms[0].expic3.options[selectedIndex].value} else {document.expiclib3.src='../images/M_images/blank.png'}\"", 'value', 'text', $row->expic3); $imagelist4 = JHTML::_('select.genericlist', $images, 'expic4', "class=\"inputbox\" size=\"1\"" . " onchange=\"javascript:if (document.forms[0].expic4.options[selectedIndex].value!='') {document.expiclib4.src='$GKB_Live_site/$ag_pathimages/' + document.forms[0].expic4.options[selectedIndex].value} else {document.expiclib4.src='../images/M_images/blank.png'}\"", 'value', 'text', $row->expic4); // Create Thumbail List $thuFiles = JFolder::files("$GKBabsolut/$ag_paththumbs"); $thumbs = array(JHTML::_('select.option', '', JText::_('Select Recipe Thumbnail'))); $tfile=""; foreach ($thuFiles as $tfile) { //notice error php 5.3 // if (eregi("bmp|gif|jpg|png|jpeg", $tfile)) { if(stristr($tfile, 'bmp') || stristr($file, 'gif') || stristr($file, 'jpg') || stristr($file, 'png') || stristr($file, 'jpeg')) $thumbs[] = JHTML::_('select.option', $tfile); } $thumblist = JHTML::_('select.genericlist', $thumbs, 'imgthumbname', "class=\"inputbox\" size=\"1\"" . " onchange=\"javascript:if (document.forms[0].imgthumbname.options[selectedIndex].value!='') {document.imagelib.src='$GKB_Live_site/$ag_paththumbs/' + document.forms[0].imgthumbname.options[selectedIndex].value} else {document.imagelib.src='../images/M_images/blank.png'}\"", 'value', 'text', $row->imgthumbname); // get list of Authors for dropdown liste $query = "SELECT * FROM `#__users` WHERE `block` =0 AND `lastvisitDate` <> '0000-00-00 00:00:00' ORDER BY `Username`"; $dbGKB->setQuery($query); $authors[] = JHTML::_('select.option', '0', '- '.JText::_('Select Author').' -', 'id', 'username' ); $authors = array_merge($authors, $dbGKB->loadObjectList()); if ($row->created_by == 0) { $dbGKB->setQuery('SELECT * FROM `#__users` WHERE `username` = "' . $row->imgauthor . '" and `block` = 0'); $rows2 = $dbGKB->loadObjectList(); if (count($rows2) >0) { $row2 = $rows2[0]; $row->created_by = $row2->id; } }



Hopefully we can figure this thing out. It is not an extremely big deal not to show the thumbnails, but it would be nice.

Please Log in to join the conversation.

More
13 years 6 months ago #4295 by over
Well we didnT really need all that code in the forum. ;)

Line 499
Code:
$thumbs = array(JHTML::_('select.option', '', JText::_('Select Recipe Thumbnail')));
add this after that line
Code:
echo '<br /><br />Images path : '.$GKBabsolut.'/'.$ag_pathimages.'<br /><br />'; print_r($imgFiles); echo '</br><br />Thumbs path : ' .$GKBabsolut.'/'.$ag_paththumbs.'<br /><br />'; print_r($thuFiles);

After saving the file to your server run the recipe manager.
Check the path to your images and thumbs.
There should appear two arrays. Hope you understand them. You should find the files in your two paths.

Please Log in to join the conversation.

Time to create page: 0.166 seconds