Back to PhocaGalleryRenderProcess class

Method getProcessPage

public static
getProcessPage
(mixed $filename, mixed $thumbInfo, mixed $refresh_url, mixed $errorMsg = '')

Method getProcessPage - Source code

public static function getProcessPage($filename, $thumbInfo, $refresh_url, $errorMsg = '')
{
    $countImg = (int) Factory::getApplication()->input->get('countimg', 0, 'get', 'INT');
    $currentImg = (int) Factory::getApplication()->input->get('currentimg', 0, 'get', 'INT');
    $paths = PhocaGalleryPath::getPath();
    if ($currentImg == 0) {
        $currentImg = 1;
    }
    $nextImg = $currentImg + 1;
    $view = Factory::getApplication()->input->get('view', '', 'get', 'string');
    //we are in whole window - not in modal box
    if ($view == 'phocagalleryi' || $view == 'phocagalleryd') {
        $header = self::getHeader('processpage');
        if ($header != '') {
            echo $header;
            $boxStyle = self::getBoxStyle();
            echo '<div style="' . $boxStyle . '">';
        }
    }
    echo '<span>' . Text::_('COM_PHOCAGALLERY_THUMBNAIL_GENERATING_WAIT') . '</span>';
    if ($errorMsg == '') {
        echo '<p>' . Text::_('COM_PHOCAGALLERY_THUMBNAIL_GENERATING') . ' <span style="color:#0066cc;">' . $filename . '</span>' . ' ... <b style="color:#009900">' . Text::_('COM_PHOCAGALLERY_OK') . '</b><br />' . '(<span style="color:#0066cc;">' . $thumbInfo . '</span>)</p>';
    } else {
        echo '<p>' . Text::_('COM_PHOCAGALLERY_THUMBNAIL_GENERATING') . ' <span style="color:#0066cc;padding:0;margin:0"> ' . $filename . '</span>' . ' ... <b style="color:#fc0000">' . Text::_('COM_PHOCAGALLERY_ERROR') . '</b><br />' . '(<span style="color:#0066cc;">' . $thumbInfo . '</span>)</p>';
    }
    if ($countImg == 0) {
        // BEGIN ---------------------------------------------------------------------------
        echo '<div class="ph-lds-ellipsis"><div></div><div></div><div></div><div></div></div><div> </div><div>' . Text::_('COM_PHOCAGALLERY_REBUILDING_PROCESS_WAIT') . '</div>';
        // END -----------------------------------------------------------------------------
    } else {
        // Creating thumbnails info
        $per = 0;
        // display percents
        if ($countImg > 0) {
            $per = round($currentImg / $countImg * 100, 0);
        }
        $perCSS = $per * 400 / 100 - 400;
        $bgCSS = 'background: #e6e6e6 url(\'' . $paths->media_img_rel_full . 'administrator/process2.png\') ' . $perCSS . 'px 0 repeat-y;';
        // BEGIN -----------------------------------------------------------------------
        //echo '<p>' . JText::_('COM_PHOCAGALLERY_GENERATING'). ': <span style="color:#0066cc">'. $currentImg .'</span> '.JText::_('COM_PHOCAGALLERY_FROM'). ' <span style="color:#0066cc">'. $countImg .'</span> '.JText::_('COM_PHOCAGALLERY_THUMBNAIL_S').'</p>';
        echo '<p>' . Text::sprintf('COM_PHOCAGALLERY_GENERATING_FROM_THUMBNAIL_S', '<span style="color:#0066cc">' . $currentImg . '</span> ', ' <span style="color:#0066cc">' . $countImg . '</span> ') . '</p>';
        //echo '<p>'.$per.' %</p>';
        //echo '<div style="width:400px;height:20px;font-size:20px;border-top:2px solid #666;border-left:2px solid #666;border-bottom:2px solid #ccc;border-right:2px solid #ccc;'.$bgCSS.'"><span style="font-size:10px;font-weight:bold">'.$per.' %</div>';
        echo '<div style="width:400px;height:20px;font-size:20px;border: 1px solid #ccc; vertical-align: middle;display: inline-block; -moz-border-radius: 2px; -webkit-border-radius: 2px; border-radius: 2px;' . $bgCSS . '"><div style="font-size:12px;font-weight:bold;color: #777;margin-top:2px;">' . $per . ' %</div></div>';
        // END -------------------------------------------------------------------------
    }
    if ($errorMsg != '') {
        $errorMessage = '';
        switch ($errorMsg) {
            case 'ErrorNotSupportedImage':
                $errorMessage = Text::_('COM_PHOCAGALLERY_ERROR_NOTSUPPORTEDIMAGE');
                break;
            case 'ErrorNoJPGFunction':
                $errorMessage = Text::_('COM_PHOCAGALLERY_ERROR_NOJPGFUNCTION');
                break;
            case 'ErrorNoPNGFunction':
                $errorMessage = Text::_('COM_PHOCAGALLERY_ERROR_NOPNGFUNCTION');
                break;
            case 'ErrorNoGIFFunction':
                $errorMessage = Text::_('COM_PHOCAGALLERY_ERROR_NOGIFFUNCTION');
                break;
            case 'ErrorNoWEBPFunction':
                $errorMessage = Text::_('COM_PHOCAGALLERY_ERROR_NOWEBPFUNCTION');
                break;
            case 'ErrorNoWBMPFunction':
                $errorMessage = Text::_('COM_PHOCAGALLERY_ERROR_NOWBMPFUNCTION');
                break;
            case 'ErrorWriteFile':
                $errorMessage = Text::_('COM_PHOCAGALLERY_ERROR_WRITEFILE');
                break;
            case 'ErrorFileOriginalNotExists':
                $errorMessage = Text::_('COM_PHOCAGALLERY_ERROR_FILEORIGINALNOTEXISTS');
                break;
            case 'ErrorCreatingFolder':
                $errorMessage = Text::_('COM_PHOCAGALLERY_ERROR_CREATINGFOLDER');
                break;
            case 'ErrorNoImageCreateTruecolor':
                $errorMessage = Text::_('COM_PHOCAGALLERY_ERROR_NOIMAGECREATETRUECOLOR');
                break;
            case 'Error1':
            case 'Error2':
            case 'Error3':
            case 'Error4':
            case 'Error5':
            default:
                $errorMessage = Text::_('COM_PHOCAGALLERY_ERROR_WHILECREATINGTHUMB') . ' (' . $errorMsg . ')';
                break;
        }
        //$view 		= JFactory::getApplication()->input->get( 'view' );
        //we are in whole window - not in modal box
        if ($view != 'phocagalleryi' && $view != 'phocagalleryd') {
            echo '<div style="text-align:left;margin: 10px 5px">';
            echo '<table border="0" cellpadding="7"><tr><td>' . Text::_('COM_PHOCAGALLERY_ERROR_MESSAGE') . ':</td><td><span style="color:#fc0000">' . $errorMessage . '</span></td></tr>';
            echo '<tr><td colspan="1" rowspan="4" valign="top" >' . Text::_('COM_PHOCAGALLERY_WHAT_TO_DO_NOW') . ' :</td>';
            echo '<td>- ' . Text::_('COM_PHOCAGALLERY_SOLUTION_BEGIN') . ' <br /><ul><li>' . Text::_('COM_PHOCAGALLERY_SOLUTION_IMAGE') . '</li><li>' . Text::_('COM_PHOCAGALLERY_SOLUTION_GD') . '</li><li>' . Text::_('COM_PHOCAGALLERY_SOLUTION_PERMISSION') . '</li></ul>' . Text::_('COM_PHOCAGALLERY_SOLUTION_END') . '<br /> <a href="' . $refresh_url . '&countimg=' . $countImg . '¤timg=' . $currentImg . '">' . Text::_('COM_PHOCAGALLERY_BACK_PHOCA_GALLERY') . '</a><div class="hr"></div></td></tr>';
            echo '<tr><td>- ' . Text::_('COM_PHOCAGALLERY_DISABLE_CREATING_THUMBS_SOLUTION') . ' <br /> <a href="/apis/component/phocagallery/?task=phocagalleryimg.disablethumbs">' . Text::_('COM_PHOCAGALLERY_BACK_DISABLE_THUMBS_GENERATING') . '</a> <br />' . Text::_('COM_PHOCAGALLERY_ENABLE_THUMBS_GENERATING_OPTIONS') . '<div class="hr"></div></td></tr>';
            echo '<tr><td>- ' . Text::_('COM_PHOCAGALLERY_MEDIA_MANAGER_SOLUTION') . ' <br /> <a href="/apis/component/media/">' . Text::_('COM_PHOCAGALLERY_MEDIA_MANAGER_LINK') . '</a><div class="hr"></div></td></tr>';
            echo '<tr><td>- <a href="https://www.phoca.cz/documentation/" target="_blank">' . JText::_('COM_PHOCAGALLERY_GO_TO_PHOCA_GALLERY_USER_MANUAL') . '</a></td></tr>';
            echo '</table>';
            echo '</div>';
        } else {
            //we are in modal box
            echo '<div style="text-align:left">';
            echo '<table border="0" cellpadding="3"
			cellspacing="3"><tr><td>' . Text::_('COM_PHOCAGALLERY_ERROR_MESSAGE') . ':</td><td><span style="color:#fc0000">' . $errorMessage . '</span></td></tr>';
            echo '<tr><td colspan="1" rowspan="3" valign="top">' . Text::_('COM_PHOCAGALLERY_WHAT_TO_DO_NOW') . ' :</td>';
            echo '<td>- ' . Text::_('COM_PHOCAGALLERY_SOLUTION_BEGIN') . ' <br /><ul><li>' . Text::_('PG COM_PHOCAGALLERY_SOLUTION_IMAGE') . '</li><li>' . Text::_('COM_PHOCAGALLERY_SOLUTION_GD') . '</li><li>' . Text::_('COM_PHOCAGALLERY_SOLUTION_PERMISSION') . '</li></ul>' . Text::_('COM_PHOCAGALLERY_SOLUTION_END') . '<br /> <a href="' . $refresh_url . '&countimg=' . $countImg . '¤timg=' . $currentImg . '">' . Text::_('COM_PHOCAGALLERY_BACK_PHOCA_GALLERY') . '</a><div class="hr"></div></td></tr>';
            echo '<td>- ' . Text::_('COM_PHOCAGALLERY_NO_SOLUTION') . ' <br /> <a href="#" onclick="SqueezeBox.close();">' . Text::_('COM_PHOCAGALLERY_BACK_PHOCA_GALLERY') . '</a></td></tr>';
            echo '</table>';
            echo '</div>';
        }
        echo '</div></body></html>';
        exit;
    }
    if ($countImg == $currentImg || $currentImg > $countImg) {
        /*$imageSid	= false;
        		$imageSid 	= preg_match("/imagesid/i", $refresh_url);
        		if (!$imageSid) {
        			$refresh_url = $refresh_url . '&imagesid='.md5(time());
        		}*/
        echo '<meta http-equiv="refresh" content="1;url=' . $refresh_url . '" />';
    } else {
        echo '<meta http-equiv="refresh" content="0;url=' . $refresh_url . '&countimg=' . $countImg . '¤timg=' . $nextImg . '" />';
    }
    echo '</div></body></html>';
    exit;
}