function action($articleid, $fieldsid, $fieldsvalueid) { $path = $this->params->get("path"); $documentpath = $this->params->get("documentpath"); if (empty($documentpath)) { $sitepath = fieldsattachHelper::getabsoluteURL(); $this->params->set("path", $sitepath . 'images' . DS . 'documents'); //$documentpath= JPATH_INSTALLATION.DS.'..'.DS.'images'.DS.'documents'; $documentpath = JPATH_BASE . DS . 'images' . DS . 'documents'; } //Categories ============================================================================ if (JRequest::getVar('option') == 'com_categories' && JRequest::getVar('layout') == "edit") { //$documentpath= JPATH_INSTALLATION.DS.'..'.DS.'images'.DS.'documentscategories'; $documentpath = JPATH_BASE . DS . 'images' . DS . 'documentscategories'; } $file = "field_" . $fieldsid . "_upload"; fieldsattachHelper::deleteFile($file, $articleid, $fieldsid, $fieldsvalueid, $documentpath); $nombreficherofinal = fieldsattachHelper::uploadFile($file, $articleid, $fieldsid, $fieldsvalueid, $documentpath); $width = 0; $height = 0; $filter = ""; $selectable = ""; $nombrefichero = ""; if (!empty($nombreficherofinal)) { $db = JFactory::getDbo(); $query = 'SELECT a.extras FROM #__fieldsattach as a WHERE a.id=' . $fieldsid . ''; $db->setQuery($query); $results = $db->loadObject(); $tmp = ""; //JError::raiseWarning( 100, $obj->type." --- ". $query ); if (!empty($results)) { $tmp = $results->extras; //JError::raiseWarning( 100, " --- ". $results->extras ); } //$str .= "<br> resultado1: ".$tmp; $lineas = explode(chr(13), $tmp); //$str .= "<br> resultado2: ".$lineas[0]; $str .= '<div>'; foreach ($lineas as $linea) { $tmp = explode('|', $linea); $width = $tmp[0]; $height = $tmp[1]; $filter = $tmp[2]; $selectable = $tmp[3]; //echo $width.'ssX'.$height.'<br>'; $nombrefichero = $_FILES[$file]["name"]; } // $app = JFactory::getApplication(); // $app->enqueueMessage( "---width:".$width ); fieldsattachHelper::resize($nombreficherofinal, $nombreficherofinal, $width, $height, $articleid, $documentpath, $filter); } }
function action($articleid, $fieldsid, $fieldsvalueid) { $path = $this->path1; $documentpath = $this->documentpath; //FIND FOLDER ************************************************************ $documentpath = JPATH_ROOT . DS . 'images' . DS . 'documents'; $option = JRequest::getVar("option"); //Categories ============================================================================ if ($option == 'com_categories') { $documentpath = JPATH_ROOT . DS . 'images' . DS . 'documentscategories'; } $file = "field_" . $fieldsid . "_upload"; fieldsattachHelper::deleteFile($file, $articleid, $fieldsid, $fieldsvalueid, $documentpath); if (!empty($_FILES[$file]['tmp_name'])) { //Create folder if not exist ---------------------------- if (!JFolder::create($documentpath . DS . $articleid)) { JError::raiseWarning(100, JTEXT::_("I haven't created:") . $documentpath . DS . $articleid); } else { //$app->enqueueMessage( JTEXT::_("Folder created:"). $documentpath .DS. $articleid) ; } $nombreficherofinal = fieldsattachHelper::uploadFile($file, $articleid, $fieldsid, $fieldsvalueid, $documentpath); $width = 0; $height = 0; $filter = ""; $selectable = ""; $nombrefichero = ""; if (!empty($nombreficherofinal)) { $db = JFactory::getDbo(); $query = 'SELECT a.extras FROM #__fieldsattach as a WHERE a.id=' . $fieldsid . ''; $db->setQuery($query); $results = $db->loadObject(); $tmp = ""; if (!empty($results)) { $tmp = $results->extras; } $lineas = explode(chr(13), $tmp); $str .= '<div>'; foreach ($lineas as $linea) { $tmp = explode('|', $linea); $width = $tmp[0]; $height = $tmp[1]; $filter = $tmp[2]; $selectable = $tmp[3]; $nombrefichero = $_FILES[$file]["name"]; } fieldsattachHelper::resize($nombreficherofinal, $nombreficherofinal, $width, $height, $articleid, $documentpath, $filter); } } }