Script dumping 1st Character of pics

Okay, this one is a little interesting to see.  We have the Class Rooms working to show images if you click on the list of class rooms.  But when you go to the Gallery and try to view the thumbnails, it's only showing the boxes with the red "x" on them.  Next up, when I right click for properties it's giving the url as:

http://xxx.com/clrooms/gallery/_7_3b7d22079c_.jpg

But when I go into the server I'm getting the url of the image should be:

http://xxx.com/clrooms/gallery/7_7_3b7d22079c.jpg

Why is dolphin dumping the first character of the file name on the thumbnails off?  If I click on one of the images then it shows a 404 error in the pop up box.  I'm finding this to be really interesting.  Any ideas on what's truncating the file name at the beginning of it?

 

Quote · 17 Apr 2010

No clue.

But your link xxx.com is interesting.

https://www.deanbassett.com
Quote · 19 Apr 2010

trully is!, good evening people

Quote · 19 Apr 2010

I certainly appreciate that, not sure I want to see where that link goes.  LOL

Was using it to just demonstrate the cutting off of the 1st character of the pics file name.  Keep in mind, it works fine for the thumbs & icons.

This link will show the issue:

http://mydatery.com/clr.php?action=gallery&ID=7

 

Quote · 19 Apr 2010

Is Class Rooms a module?

Quote · 19 Apr 2010

It's becoming one.  We've just about got it finished for D6 and starting on D7 shortly.  It'll be a freebie just to see if anyone wants to create an even larger module and offer it for free.  Any ideas on this thing would be greatly appreciated.  I'm about to start posting the code that has to do with these images just to see if anyone can pick it off.

 

Actually, screw it.  Here's the functions we're using in inc/classes/BxDolClassRooms.php Anyone see where I'm screwin' up here?

 


function ShowClroomsGalleryPage() {
  global $logged;
  global $site;

  $iNameIndex = 7775;
  $sHeaderT = _t( "_Clroom gallery" );
  $sHeader = _t( "_Clroom gallery" );
  $sMainCode = '';

  if( $logged['member'] = member_auth( 0, false ) )
   $iMemberID = (int)$_COOKIE['memberID'];
  else {
   $iMemberID = 0;
   $logged['admin'] = member_auth( 1, false );
  }

  $iClroomsID = (int)$_REQUEST['ID'];

  if ( !$iClroomsID ) {
   Header( "Location: {$site['url']}{$this->sCurrFile}" );
   exit;
  }

  if ( $aClroomsInfo = $this->getClroomsInfo( $iClroomsID ) ) {
   $aClroomsInfo['Name_html'] = htmlspecialchars_adv( $aClroomsInfo['Name'] );

   if ( (int)$aClroomsInfo['hidden_clroom'] and !$this->isClroomsMember( $iMemberID, $iClroomsID ) and !$logged['admin'] )
    $sMainCode = _t( "_You cannot view gallery while not a clroom member" );
   else {
    if( $aClroomsInfo['status'] == 'Active' or $aClroomsInfo['creatorID'] == $iMemberID or $logged['admin'] ) {
     $sHeader = _t( "_Clroom gallery" );
     $sMainCode = $this->PCGenClroomsGallery($iMemberID, $iClroomsID, $aClroomsInfo);
    } else {
     $iNameIndex = 0;
     $sHeader = _t( "_Clroom is suspended" );
     $sHeaderT = _t( "_Clroom is suspended" );
     $sMainCode = _t( "_Sorry, clroom is suspended" );
    }
   }
  } else
   $sMainCode = _t( "_Clroom not found_desc" );

  return array($iNameIndex, $sHeader, $sHeaderT, $sMainCode);
 }

 function PCGenClroomsGallery($iMemberID, $iClroomsID, $aClroomsInfo) {
  global $site;

  $sUploadedByC = _t('_Uploaded by');
  $sSetAsThumbC = _t('_Set as thumbnail');
  $sDelImgC = _t('_Delete image');
  $sUploadImageC = _t('_Upload image');

  $sClroomsLink = $this->getClroomsUrl($iClroomsID, $aClroomsInfo['Uri']);

  $sBreadCrumbs = <<<EOJ
<div class="clrooms_breadcrumbs">
 <a href="{$site['url']}">{$site['title']}</a> /
 <a href="{$site['url']}{$this->sCurrFile}">__Clrooms__</a> /
 <a href="{$sClroomsLink}">{$aClroomsInfo['Name_html']}</a> /
 <span class="active_link">__Clroom gallery__</span>
</div>
EOJ;

  $sBreadCrumbs = str_replace( "__Clrooms__", _t( "_Clrooms" ), $sBreadCrumbs );
  $sBreadCrumbs = str_replace( "__Clroom gallery__", _t( "_Clroom gallery" ), $sBreadCrumbs );

  $sQuerySQL = "
   SELECT `ClroomsGallery`.*, `Profiles`.`NickName`
   FROM `ClroomsGallery`
   LEFT JOIN `Profiles` ON `ClroomsGallery`.`by`=`Profiles`.`ID`
   WHERE `ClroomsGallery`.`clroomID`='{$iClroomsID}'
   ORDER BY `ClroomsGallery`.`ID`
  ";

  $resPics = db_res( $sQuerySQL );

  $sRetHtml = <<<EOF
{$sBreadCrumbs}
<div class="clroom_gallery_wrapper">
 <div class="clear_both"></div>
EOF;

  while( $arrPic = mysql_fetch_assoc( $resPics ) ) {
   $sGalNick = htmlspecialchars_adv($arrPic['NickName']);
   $iNewJSW = $arrPic['width']+20;
   $iNewJSH = $arrPic['height']+20;

   $sRetHtml .= <<<EOF
<div class="clroom_gallery_pic" style="">
 <a href="{$site['clrooms_gallery']}{$arrPic['clroomsID']}_{$arrPic['ID']}_{$arrPic['seed']}.{$arrPic['ext']}"
   title="{$sUploadedByC} {$sGalNick}" alt="window.open(this.href, '_blank', 'width={$iNewJSW},height={$iNewJSH}');return false;">
  <img src="{$site['clrooms_gallery']}{$arrPic['clroomsID']}_{$arrPic['ID']}_{$arrPic['seed']}_.{$arrPic['ext']}"
    style="width:{$arrPic['width_']}px;height:{$arrPic['height_']}px" alt="" />
 </a>
EOF;
   if( $aClroomsInfo['thumb'] != $arrPic['ID'] and $aClroomsInfo['creatorID'] == $iMemberID ) {
    $sRetHtml .= <<<EOF
<br />
<a href="{$site['url']}clroom_actions.php?ID={$iClroomsID}&a=def&img={$arrPic['ID']}" class="clroom_set_thumb">{$sSetAsThumbC}</a>
EOF;
   }

   if( $aClroomsInfo['creatorID'] == $iMemberID or $arrPic['by'] == $iMemberID ) {
    $sRetHtml .= <<<EOF
<br />
<a href="{$site['url']}clroom_actions.php?ID={$iClroomsID}&a=delimg&img={$arrPic['ID']}" class="clroom_set_thumb" alt="return confirm('<?=_t('_Are you sure want to delete this image?')?>');">{$sDelImgC}</a>
EOF;
   }

   $sRetHtml .= '</div>';
  }

  $sRetHtml .= '<div class="clear_both"></div></div>';

  if( ( (int)$aClroomsInfo['members_post_images'] and $this->isClroomsMember( $iMemberID, $iClroomsID ) ) or $aClroomsInfo['creatorID'] == $iMemberID ) {
   $sRetHtml .= <<<EOF
<a href="{$site['url']}clroom_actions.php?a=upload&ID={$iClroomsID}" class="actions">{$sUploadImageC}</a>
EOF;
  }

  return $sRetHtml;
 }

 


 

 

Quote · 19 Apr 2010

There is a mismatch between the a href link and the image source.


<div class="clroom_gallery_pic" style="">
<a href="{$site['clrooms_gallery']}{$arrPic['clroomsID']}_{$arrPic['ID']}_{$arrPic['seed']}.{$arrPic['ext']}"
title="{$sUploadedByC} {$sGalNick}" alt="window.open(this.href, '_blank', 'width={$iNewJSW},height={$iNewJSH}');return false;">
<img src="{$site['clrooms_gallery']}{$arrPic['clroomsID']}_{$arrPic['ID']}_{$arrPic['seed']}_.{$arrPic['ext']}"
style="width:{$arrPic['width_']}px;height:{$arrPic['height_']}px" alt="" />
</a>

Do you see it? That might be your issue.

https://www.deanbassett.com
Quote · 19 Apr 2010

Okay, this one is a little interesting to see.  We have the Class Rooms working to show images if you click on the list of class rooms.  But when you go to the Gallery and try to view the thumbnails, it's only showing the boxes with the red "x" on them.  Next up, when I right click for properties it's giving the url as:

http://xxx.com/clrooms/gallery/_7_3b7d22079c_.jpg

But when I go into the server I'm getting the url of the image should be:

http://xxx.com/clrooms/gallery/7_7_3b7d22079c.jpg

Why is dolphin dumping the first character of the file name on the thumbnails off?  If I click on one of the images then it shows a 404 error in the pop up box.  I'm finding this to be really interesting.  Any ideas on what's truncating the file name at the beginning of it?

Actually your loosing both first and last character before the extension. That spot i pointed out should correct the last character. Lets see if i can find the other one.

But of course i am not seeing it, but it has to be there. Hmmmm.

https://www.deanbassett.com
Quote · 19 Apr 2010

Your on to something there.

Changed:

 

<img src="{$site['clrooms_gallery']}{$arrPic['clroomsID']}_{$arrPic['ID']}_{$arrPic['seed']}_.{$arrPic['ext']}"
style="width:{$arrPic['width_']}px;height:{$arrPic['height_']}px" alt="" />

to:

 

<img src="{$site['clrooms_gallery']}{$arrPic['clroomsID']}_{$arrPic['ID']}_{$arrPic['seed']}.{$arrPic['ext']}"
style="width:{$arrPic['width_']}px;height:{$arrPic['height_']}px" alt="" />

And that fixed the end.  It was actually adding an underscore between the last character in the file name & the extension.

 

Quote · 19 Apr 2010

This might help out also, it's what I have in my clroom_actions.php file:

 


$query = "
           INSERT INTO `ClroomsGallery` SET
            `clroomID` = $clroomID,
            `ext`     = '$Ext',
            `width`   = $imgWidth,
            `height`  = $imgHeight,
            `width_`  = $imgWidth_,
            `height_` = $imgHeight_,
            `by`      = $memberID,
            `seed`    = '$seed'
           ";
          
          db_res( $query );
          
          $imgID = mysql_insert_id($GLOBALS['MySQL']->link);
          
          rename( $tempImg,  $oClrooms->sClrGalPath."{$clroomID}_{$imgID}_{$seed}.{$Ext}" );
          rename( $tempImg_, $oClrooms->sClrGalPath."{$clroomID}_{$imgID}_{$seed}_.{$Ext}" );
          rename( $tempImg_icon, $oClrooms->sClrGalPath."{$clroomID}_{$imgID}_{$seed}_icon.{$Ext}" );
          
          chmod( $oClrooms->sClrGalPath."{$clroomID}_{$imgID}_{$seed}.{$Ext}", 0644 );
          chmod( $oClrooms->sClrGalPath."{$clroomID}_{$imgID}_{$seed}_.{$Ext}", 0644 );
          chmod( $oClrooms->sClrGalPath."{$clroomID}_{$imgID}_{$seed}_icon.{$Ext}", 0644 );
          
          if( $_POST['set_def'] == 'yes' and $arrClroom['creatorID'] == $memberID )
           $oClrooms->setClroomsThumb( $clroomID, $imgID );
          
          //if( $_POST['back'] == 'home' )
           $getBackUrl = "clr.php?action=clroom&ID={$clroomID}";
          //else
          // $getBackUrl = "clr.php?action=gallery&ID={$clroomID}";
          
          $getBackCode = " (<a href=\"{$getBackUrl}\">"._t('_Back to clroom', $arrClroom['Name'])."</a>)";

Quote · 20 Apr 2010

In your url http://xxx.com/clrooms/gallery/7_7_3b7d22079c.jpg  is the clroomsID 7_7 or just 7?

Quote · 20 Apr 2010

Just 7

 

Quote · 20 Apr 2010

We got it guys.  This one was found thanks to Deano & Mauriceano.

 

Changed this:

 

<a href="{$site['clrooms_gallery']}{$arrPic['clroomsID']}_{$arrPic['ID']}_{$arrPic['seed']}.{$arrPic['ext']}"
title="{$sUploadedByC} {$sGalNick}" alt="window.open(this.href, '_blank', 'width={$iNewJSW},height={$iNewJSH}');return false;">
<img src="{$site['clrooms_gallery']}{$arrPic['clroomsID']}_{$arrPic['ID']}_{$arrPic['seed']}_.{$arrPic['ext']}"
style="width:{$arrPic['width_']}px;height:{$arrPic['height_']}px" alt="" />

To:

<a href="{$site['clrooms_gallery']}{$arrPic['clroomID']}_{$arrPic['ID']}_{$arrPic['seed']}.{$arrPic['ext']}"
title="{$sUploadedByC} {$sGalNick}" alt="window.open(this.href, '_blank', 'width={$iNewJSW},height={$iNewJSH}');return false;">
<img src="{$site['clrooms_gallery']}{$arrPic['clroomID']}_{$arrPic['ID']}_{$arrPic['seed']}_.{$arrPic['ext']}"
style="width:{$arrPic['width_']}px;height:{$arrPic['height_']}px" alt="" />

The problem with having a DB name Clrooms with a column name ID and then another named ClroomsGallery with a column named clroomID

Just doesn't make life all the simple.  But when mauriceano asked that last question it all clicked in beautifully.  Will be adding a class paper to them next.  This thing is starting to look good.  Thanks a million guys.

 

Quote · 20 Apr 2010

Your welcome.

Now if your using my tools, how about a review. I could use the market points. :)

https://www.deanbassett.com
Quote · 20 Apr 2010

You got 2 reviews out of me Deano, profile & tools.  What less could I do for ya.  I'm off to get some dinner and refresh my brain.  We cleared up the Tinymce today, Division by Zero & these images.  I'd say that's an awesome day overall.

Again, thanks a million guys.  Even to HL for helpin' to bump this thread just a little and keep it in everyone's line of vision.  This is simply proof that an extra set of eyes can help us see things completely different when we're starin' at it for to many hours.

Quote · 20 Apr 2010

Sweet. Now if i could just stay ahead.

Guess i need to release a bunch of free stuff.

https://www.deanbassett.com
Quote · 20 Apr 2010

 

Sweet. Now if i could just stay ahead.

Guess i need to release a bunch of free stuff.

 

 

I don't think you've got anything you can pop out for free that's as big (file size wise) as these Class Rooms are.  I'm really scared to look, but the SQL is over 600 lines alone.  Gawd is this mother huge, no wonder I keep gettin' lost on DB Tables & Columns.  LOL

Quote · 20 Apr 2010
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.