music thumbnail

Is there a way to upload a image for every music file I upload to the music gallery?

This is basically what I need to do. When I add music from an artist I can also upload a picture of the artist as well. I really need to have the picture of the artist on the page and next to the link. My whole site is basically based on this function. PLEASE PLEASE PLEASE HELP ME WITH THIS ONE!!!!

 

THANKS

DJ DUPREE

Quote · 25 Jul 2008

Dupree did you get an answer and resolve this issue if so kindly let me know as i am looking for same solution... very much needed

Quote · 8 Jan 2011

 

Dupree did you get an answer and resolve this issue if so kindly let me know as i am looking for same solution... very much needed

If you want something like this done, I recommend you make a post in the jobs section.

BoonEx Certified Host: Zarconia.net - Fully Supported Shared and Dedicated for Dolphin
Quote · 8 Jan 2011

Magna i thought may be we have a module for this already existing i made my initial search but not able to find a mod for it. Though this is something essential for Music Section.

Quote · 12 Jan 2011

@ Magnussoft

 

I have tried several times uploading wma music files but its not playing goes into not processed section and when i try to play says "File Error", Mp3 is working fine and i have no issues with mp3 though i notice mp3 file size is larger then wma file type.

If you know how to make wma music file type working would appreciate.

Quote · 13 Jan 2011

Hello I think there need small changes that you can upload sounds thumbnail. Make this post in job section!

PS: If possible do not write me personally, please try to ask on the forum first
Quote · 13 Jan 2011

Yea i also am looking for a solution to this. Thanks

Quote · 13 Jan 2011

 

Yea i also am looking for a solution to this. Thanks

ok I'll make this for free soon

PS: If possible do not write me personally, please try to ask on the forum first
Quote · 14 Jan 2011

Great, looking forward to it and also if you can check and advise me .wma file type is not playing any one knows why or do they incur the same issue with WMA FILE TYPE IN SOUND MODULE

Quote · 14 Jan 2011

guys any luck with the music thumbnails ???

Quote · 20 Jan 2011

 

guys any luck with the music thumbnails ???

Sorry no time for this

PS: If possible do not write me personally, please try to ask on the forum first
Quote · 21 Jan 2011

It worked for me:


    Implement thumbs to sounds!!!

    1. Open the modules/boonex/sounds/classes/BxSoundsUploader.php

        a. find this code line:

            function GenSendFileInfoForm($iFileID, $aDefaultValues = array()) {

        and add this function before that code line:

            //-- eSASe modification (id: add posibility to select thumb for sound )--//

            function _GenSendFileInfoForm($iFileID, $aDefaultValues = array(), $aPossibleImage = array(), $aPossibleDuration = array()) {
                header("Content-type: text/html; charset=utf-8");
                $this->addJsTranslation(array(
                    '_bx_' . $this->sUploadTypeLC . 's_val_title_err',
                    '_bx_' . $this->sUploadTypeLC . 's_val_descr_err'
                ));

                $oCategories = new BxDolCategories();
                $oCategories->getTagObjectConfig();
                $aFormCategories['categories'] = $oCategories->getGroupChooser('bx_' . $this->sUploadTypeLC . 's', $this->_iOwnerId, true);
                $aFormCategories['categories']['required'] = false;
                $sKey = 'album';
                $aAlbums = array();
                if ($this->_aExtras[$sKey] != '') {
                    $aAlbums[BX_DOL_UPLOADER_EP_PREFIX . $sKey] = array (
                        'type' => 'hidden',
                        'name' => BX_DOL_UPLOADER_EP_PREFIX . $sKey,
                        'value' => stripslashes($this->_aExtras[$sKey])
                    );

                } else {
                    $oAlbum = new BxDolAlbums('bx_' . $this->sUploadTypeLC . 's');
                    $aAlbumList = $oAlbum->getAlbumList(array('owner'=>$this->_iOwnerId));
           
                    if (count($aAlbumList) > 0) {
                        foreach ($aAlbumList as $aValue)
                            $aList[$aValue['ID']] = stripslashes($aValue['Caption']);
                    }
                    else {
                        $sDefName = $oAlbum->getAlbumDefaultName();
                        $aList[$sDefName] = stripslashes($sDefName);
                    }
                    $aAlbums['album'] = array(
                      'type' => 'select_box',
                      'name' => BX_DOL_UPLOADER_EP_PREFIX . $sKey,
                      'caption' => _t('_sys_album'),
                      'values' => $aList
                    );
                }

                $sCaptionVal = ($this->sSendFileInfoFormCaption != '') ? $this->sSendFileInfoFormCaption : _t('_Info');
                // processing of possible default values
                $aInputValues = array('title', 'tags', 'description', 'type', $this->sUploadTypeLC);
                foreach ($aInputValues as $sField) {
                    $sEmpty = $sField == 'type' ? 'upload' : '';
                    $sTemp = isset($aDefaultValues[$sField]) ? strip_tags($aDefaultValues[$sField]) : $sEmpty;
                    $aDefaultValues[$sField] = $sTemp;
                }
                $aForm = array(
                    'form_attrs' => array(
                        'id' => $this->sUploadTypeLC . '_file_info_form',
                        'method' => 'post',
                        'action' => $this->sWorkingFile,
                        'target' => 'upload_file_info_frame_' . $iFileID,
                        'enctype' => 'multipart/form-data',
                    ),
                    'inputs' => array(
                        'header2' => array(
                            'type' => 'block_header',
                            'caption' => $sCaptionVal,
                            'collapsable' => true
                        ),
                        'title' => array(
                            'type' => 'text',
                            'name' => 'title',
                            'caption' => _t('_Title'),
                            'required' => true,
                            'value' => $aDefaultValues['title']
                        ),
                        'tags' => array(
                            'type' => 'text',
                            'name' => 'tags',
                            'caption' => _t('_Tags'),
                            'info' => _t('_Tags_desc'),
                            'value' => $aDefaultValues['tags']
                        ),
                        'description' => array(
                            'type' => 'textarea',
                            'name' => 'description',
                            'caption' => _t('_Description'),
                            'required' => true,
                            'value' => $aDefaultValues['description']
                        ),
                        'image' => array(
                            'type' => 'file',
                            'name' => 'image',
                            'caption' => _t('_Upload image'),
                        ),
                        'media_id' => array(
                            'type' => 'hidden',
                            'name' => 'file_id',
                            'value' => $iFileID,
                        ),
                        'hidden_action' => array(
                            'type' => 'hidden',
                            'name' => 'action',
                            'value' => 'accept_file_info'
                        ),
                        $this->sUploadTypeLC => array(
                            'type' => 'hidden',
                            'name' => $this->sUploadTypeLC,
                            'value' => $aDefaultValues[$this->sUploadTypeLC]
                        ),
                        'type' => array(
                            'type' => 'hidden',
                            'name' => 'type',
                            'value' => $aDefaultValues['type']
                        )
                    ),
                );

                //--- Process Extras ---//
                foreach($this->_aExtras as $sKey => $mixedValue)
                    $aForm['inputs'][BX_DOL_UPLOADER_EP_PREFIX . $sKey] = array (
                        'type' => 'hidden',
                        'name' => BX_DOL_UPLOADER_EP_PREFIX . $sKey,
                        'value' => $mixedValue
                    );

                // merging categories
                $aForm['inputs'] = $this->getUploadFormArray($aForm['inputs'], array($aFormCategories, $aAlbums));

                if (is_array($aPossibleImage) && count($aPossibleImage)>0)
                    $aForm['inputs'] = array_merge($aForm['inputs'], $aPossibleImage);

                if (is_array($aPossibleDuration) && count($aPossibleDuration)>0)
                    $aForm['inputs'] = array_merge($aForm['inputs'], $aPossibleDuration);

                $aForm['inputs'][] = array(
                    'type' => 'input_set',
                    'colspan' => true,
                    0 => array(
                        'type' => 'submit',
                        'name' => 'upload',
                        'value' => _t('_Submit'),
                        'colspan' => true,
                        'attrs' => array(
                            'onclick' => "return parent." . $this->_sJsPostObject . ".doValidateFileInfo(this, '" . $iFileID . "');",
                        )
                    ),
                    1 => array(
                        'type' => 'button',
                        'name' => 'close',
                        'value' => _t('_bx_'.$this->sUploadTypeLC.'s_close'),
                        'colspan' => true,
                        'attrs' => array(
                            'onclick' => "return parent." . $this->_sJsPostObject . ".cancelSendFileInfo('" . $iFileID . "', ''); ",
                        )
                    ),
                    2 => array(
                        'type' => 'button',
                        'name' => 'delete',
                        'value' => _t('_bx_'.$this->sUploadTypeLC.'s_admin_delete'),
                        'colspan' => true,
                        'attrs' => array(
                            'onclick' => "return parent." . $this->_sJsPostObject . ".cancelSendFileInfo('" . $iFileID . "', '" . $this->sWorkingFile . "'); ",
                        )
                    )
                );

                $oForm = new BxTemplFormView($aForm);
                $sForm = $oForm->getCode();
                $sFormSafeJS = str_replace(array("'", "r", "n"), array("'"), $sForm);

                return "<script src='" . BX_DOL_URL_ROOT . "inc/js/jquery.webForms.js' type='text/javascript' language='javascript'></script><script type='text/javascript'>parent." . $this->_sJsPostObject . ".genSendFileInfoForm('" . $iFileID . "', '" . $sFormSafeJS . "'); parent." . $this->_sJsPostObject . "._loading(false);</script>";
            }
           
            //--

        b. find this code line:
       
            $oCateg->reparseObjTags('bx_sounds', $iMusicID);

        add these code lines below:

            //-- eSASe modification (id: add posibility to select thumb for sound )--//

            if( isset($_FILES['image']['type']) ) {
                $this -> oModule -> uploadSoundThumb($_FILES['image'], $iMusicID);
            }

            //--

    2. Open the modules/boonex/sounds/classes/BxSoundsConfig.php

        find thes code lines:

            $this->aFilePostfix = array(
                '.mp3',
                '.jpg'
            );

        add these code lines below:

            //-- eSASe modification (id: add posibility to select thumb for sound )--//

            $this -> iSoundThumbWidth  = 148;
            $this -> iSoundThumbHeight = 110;
            $this -> aAllowedFileType  = array('image/jpeg', 'image/png', 'image/gif', 'image/jpg');
            $this -> sThumbSaveDir     = BX_DIRECTORY_PATH_ROOT . 'flash/modules/mp3/files/';
            $this -> sThumbUrl         = BX_DOL_URL_ROOT . 'flash/modules/mp3/files/';

            //--

    3. Open the modules/boonex/sounds/classes/BxSoundsModule.php

        find these code lines:

            function serviceGetProfileCat () {
                return PROFILE_SOUND_CATEGORY;
            }

        add this functions below :

            //-- eSASe modification (id: add posibility to select thumb for sound )--//

            function actionEdit ($iFileId) {
                $iFileId = (int)$iFileId > 0 ? (int)$iFileId : (int)$_POST['fileId'];
                if ($iFileId == 0)
                   exit;
               
                $this->aPageTmpl['name_index'] = 44;
                $sJsCode = '<script language="javascript">window.setTimeout(function () { window.parent.opener.location = window.parent.opener.location; window.parent.close(); }, 3000); </script>';
                $aManageArray = array('medTitle', 'medTags', 'medDesc', 'medProfId', 'Categories');
                $aInfo = $this->_oDb->getFileInfo(array('fileId'=>$iFileId), false, $aManageArray);
                if (!$this->isAllowedEdit($aInfo))
                   $sCode = MsgBox(_t('_' . $this->_oConfig->getMainPrefix() . '_access_denied')) . $sJsCode;
                else {
                    $oCategories = new BxDolCategories();
                    $oCategories->getTagObjectConfig();               
                    $aCategories = $oCategories->getGroupChooser($this->_oConfig->getMainPrefix(), $this->_iProfileId, true);
                    $aCategories['value'] = explode(CATEGORIES_DIVIDER, $aInfo['Categories']);
                   
                    $sThumbImage = $this -> _oConfig -> sThumbSaveDir . $iFileId . '.jpg';

                    $aForm = array(
                        'form_attrs' => array(
                            'id' => $this->_oConfig->getMainPrefix() . '_upload_form',
                            'method' => 'post',
                            'action' => BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'edit/' . $iFileId,
                            'enctype' => 'multipart/form-data',
                        ),
                        'params' => array (
                            'db' => array(
                                'submit_name' => 'submit',
                            ),
                            'checker_helper' => 'BxSupportCheckerHelper',
                        ),
                        'inputs' => array(
                            'header' => array(
                                'type' => 'block_header',
                                'caption' => _t('_Info'),
                            ),
                            'title' => array(
                                'type' => 'text',
                                'name' => 'medTitle',
                                'caption' => _t('_Title'),
                                'required' => true,
                                'value' => $aInfo['medTitle'],
                                'checker' => array ( 
                                    'func' => 'length',
                                    'params' => array(3, 128),
                                    'error' => _t('_td_err_incorrect_length'),
                                ),
                            ),
                            'tags' => array(
                                'type' => 'text',
                                'name' => 'medTags',
                                'caption' => _t('_Tags'),
                                'info' => _t('_Tags_desc'),
                                'value' => $aInfo['medTags']
                            ),
                            'description' => array(
                                'type' => 'textarea',
                                'name' => 'medDesc',
                                'caption' => _t('_Description'),
                                'required' => true,
                                'value' => $aInfo['medDesc'],
                                'checker' => array ( 
                                    'func' => 'length',
                                    'params' => array(3, 65536),
                                    'error' => _t('_td_err_incorrect_length'),
                                ),
                            ),
                            'image' => array(
                                'type' => 'file',
                                'name' => 'image',
                                'caption' => _t('_Upload image'),
                            ),
                            'current_image' => array(
                                'type' => 'custom',
                                'content' => _t('_Delete') . ' <input name="delete_thumb" type="checkbox"><br /><img src="'
                                    . $this -> _oConfig -> sThumbUrl . $iFileId . '.jpg" />',
                            ),
                            'categories' => $aCategories,
                            'fileId' => array(
                                'type' => 'hidden',
                                'name' => 'fileId',
                                'value' => $iFileId,
                            ),
                            'medProfId' => array(
                                'type' => 'hidden',
                                'name' => 'medProfId',
                                'value' => $aInfo['medProfId'],
                            ),
                            'submit' => array(
                                'type' => 'submit',
                                'name' => 'submit',
                                'value' => _t('_Submit'),
                                'colspan' => true,
                            ),
                        ),
                    );
                   
                    $bThumbExist = file_exists($sThumbImage) ? true : false;
                    if(!$bThumbExist) {
                        unset($aForm['inputs']['current_image']);
                    }

                    $oForm = new BxTemplFormView($aForm);
                    $oForm->initChecker();           
                    if ($oForm->isSubmittedAndValid()) {

                        $aValues = array();
                        foreach ($aManageArray as $sKey) {
                            if ($sKey != 'Categories')
                               $aValues[$sKey] = $_POST[$sKey];
                            else {
                               $aValues[$sKey] = implode(CATEGORIES_DIVIDER, $_POST[$sKey]);
                            }
                        }

                        $bUploadRes = false;

                        if( isset($_POST['delete_thumb']) && $bThumbExist ) {
                            //delete thumb
                            @unlink($sThumbImage);
                            $bUploadRes = true;
                        }

                        if( isset($_FILES['image']['type']) ) {
                            $this -> uploadSoundThumb($_FILES['image'], $iFileId);
                            $bUploadRes = true;
                        }

                        if ($this->_oDb->updateData($iFileId, $aValues) || $bUploadRes) {
                            $sType = $this->_oConfig->getMainPrefix();
                            bx_import('BxDolCategories');
                           
                            $oTag = new BxDolTags();
                            $oTag->reparseObjTags($sType, $iFileId);
                            $oCateg = new BxDolCategories();
                            $oCateg->reparseObjTags($sType, $iFileId);

                            $sCode = MsgBox(_t('_' . $this->_oConfig->getMainPrefix() . '_save_success')) . $sJsCode;
                        }
                    }   
                    else {
                        $sCode = $oForm->getCode();              
                        $this->aPageTmpl['css_name'] = array('forms_adv.css', 'explanation.css');
                    }   
                }   
                $this->aPageTmpl['header'] = _t('_Edit');
                $this->_oTemplate->pageCode($this->aPageTmpl, array('page_main_code' => $sCode));            
            }

            function uploadSoundThumb($aThumbInfo, $iFileId)
            {
                if( isset($aThumbInfo['type'], $aThumbInfo['tmp_name'])
                    && in_array($aThumbInfo['type'], $this -> _oConfig -> aAllowedFileType) ) {

                    //upload and resize thumb image
                    return imageResize($aThumbInfo['tmp_name']
                        , $this -> _oConfig -> sThumbSaveDir . $iFileId . '.jpg'
                        , $this -> _oConfig -> iSoundThumbWidth
                        , $this -> _oConfig -> iSoundThumbHeight);
                }
            }

            //--

    4. Open the flash/modules/mp3/inc/actions.inc.php

        find and remove there these code lines:

           case 'screenshot':
            //--- Prepare data ---//
            $iWidth = isset($_REQUEST['width']) ? (int)$_REQUEST['width'] : 0;
            $iHeight = isset($_REQUEST['height']) ? (int)$_REQUEST['height'] : 0;
            $sData = isset($_REQUEST['data']) ? process_db_input($_REQUEST['data']) : "";
            $aImageData = explode(',', $sData);
            $iLength = count($aImageData);
            for($i=0; $i<$iLength; $i++)
                $aImageData[$i] = base_convert($aImageData[$i], 36, 10);
            if($iLength != $iWidth * $iHeight || !function_exists("imagecreatetruecolor")) break;

            //--- Create Image Resource ---//
            $rImage = @imagecreatetruecolor($iWidth, $iHeight);
            for ($i = 0, $y = 0; $y < $iHeight; $y++ )
                for ( $x = 0; $x < $iWidth; $x++, $i++)
                    @imagesetpixel ($rImage, $x, $y, $aImageData[$i]);

            //--- Save image file ---//
            $sUser = process_db_input($_REQUEST['user']);
            if(empty($sId)) $sId = $sUser . TEMP_FILE_NAME;
            $sFileName = $sFilesPathMp3 . $sId . SCREENSHOT_EXT;
            @imagejpeg($rImage, $sFileName, 100);
            break;

Quote · 8 Feb 2013

So, I followed the instructions posted above by .  Thank you.  It does work.  Esase had originally offered this mod for free back in 2011.  I believe he too has since left the Boonex community (another one bit the dust) so its difficult to fix this.

Anyway, I tried this free mod.  It does work.  But needs tweaking.  Hopefully, someone can help with the tweaks since this has been a reason why so many people have left Boonex.  If you have a Sounds module, you really should be allowed to choose a cover!  And this forum is filled with people asking for this all the way back to 2009...

So, here are the problems I found with this mod :

New sound upload problems.

Firstly I seem to have a problem with the uploads because my files are forever "pending".   Might be a cron problem that I have yet to understand.

This means that, until I understand this problem, I have to click "Pending Processing" to find the file I have just uploaded. 

I then have to click "Edit" in order to add the file info : title, description, tags, image...

---Here is where the above code kicks in :

When I click EDIT now, it opens a popup window.  The 1st problem is the window is transparent making it difficult to work with.

I can indeed all everything, including a unique thumbnail for the sound which is fantastic.

But then a problem :

  • If I change my mind and want to close the EDIT window, I can't.  No option to close the popup.
  • When I finishing editing, I click SUBMIT.  But the problem is I get redirected to http://mysite.com/m/edit/9 and not the sound page.  

This sucks and I can't get around this.  If anyone can read the above code and identify the problem, I would be very grateful for your feedback.

Quote · 28 Jun 2014
 
 
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.