application/modules/g/views/helpers/Image.php
protected function _renderUpload(
        $imageIdOrRecord, $template = null, array $htmlAttribs = array(), $partial = ''
    ) {
        if (!empty($template)) {
            $scaler = $this->_getImageScaler();
            $src = $scaler->getScaledUrl($imageIdOrRecord, $template);
            $tplScalingParams = $scaler->getTemplateParameters($template);
            $htmlAttribs = array_merge(
                $htmlAttribs,
                $this->_getHtmlAttribsFromSizeParams($tplScalingParams)
            );
        } else {
            if ($imageIdOrRecord instanceof Garp_Db_Table_Row) {
                $filename = $imageIdOrRecord->filename;
            } else {
                $imageModel = new Model_Image();
                $filename = $imageModel->fetchFilenameById($imageIdOrRecord);
            }
            $file = new Garp_Image_File(Garp_File::FILE_VARIANT_UPLOAD);
            $src = $file->getUrl($filename);
        }

        if (!array_key_exists('alt', $htmlAttribs)) {
            $htmlAttribs['alt'] = '';
        }

        $htmlAttribs['src'] = $src;
        $imgTag = '<img' . $this->_htmlAttribs($htmlAttribs) . '>';

        if ($imageIdOrRecord instanceof Garp_Db_Table_Row) {
            if ($partial) {
                $module  = 'default';
            } else {
                $partial = 'partials/image.phtml';
                $module  = 'g';
            }
            return $this->view->partial(
                $partial,
                $module,
                array(
                    'imgTag' => $imgTag,
                    'imgObject' => $imageIdOrRecord
                )
            );
        } else {
            return $imgTag;
        }
    }
protected function _renderUpload(
        $imageIdOrRecord, $template = null, array $htmlAttribs = array(), $partial = ''
    ) {
        if (!empty($template)) {
            $scaler = $this->_getImageScaler();
            $src = $scaler->getScaledUrl($imageIdOrRecord, $template);
            $tplScalingParams = $scaler->getTemplateParameters($template);
            $htmlAttribs = array_merge(
                $htmlAttribs,
                $this->_getHtmlAttribsFromSizeParams($tplScalingParams)
            );
        } else {
            if ($imageIdOrRecord instanceof Garp_Db_Table_Row) {
                $filename = $imageIdOrRecord->filename;
            } else {
                $imageModel = new Model_Image();
                $filename = $imageModel->fetchFilenameById($imageIdOrRecord);
            }
            $file = new Garp_Image_File(Garp_File::FILE_VARIANT_UPLOAD);
            $src = $file->getUrl($filename);
        }

        if (!array_key_exists('alt', $htmlAttribs)) {
            $htmlAttribs['alt'] = '';
        }

        $htmlAttribs['src'] = $src;
        $imgTag = '<img' . $this->_htmlAttribs($htmlAttribs) . '>';

        if ($imageIdOrRecord instanceof Garp_Db_Table_Row) {
            if ($partial) {
                $module  = 'default';
            } else {
                $partial = 'partials/image.phtml';
                $module  = 'g';
            }
            return $this->view->partial(
                $partial,
                $module,
                array(
                    'imgTag' => $imgTag,
                    'imgObject' => $imageIdOrRecord
                )
            );
        } else {
            return $imgTag;
        }
    }
protected function _renderUpload ( $ imageIdOrRecord , $ template = null , array $ htmlAttribs = array ( ) , $ partial = '' ) { if ( ! empty ( $ template ) ) { $ scaler = $ this -> _getImageScaler ( ) ; $ src = $ scaler -> getScaledUrl ( $ imageIdOrRecord , $ template ) ; $ tplScalingParams = $ scaler -> getTemplateParameters ( $ template ) ; $ htmlAttribs = array_merge ( $ htmlAttribs , $ this -> _getHtmlAttribsFromSizeParams ( $ tplScalingParams ) ) ; } else { if ( $ imageIdOrRecord instanceof Garp_Db_Table_Row ) { $ filename = $ imageIdOrRecord -> filename ; } else { $ imageModel = new Model_Image ( ) ; $ filename = $ imageModel -> fetchFilenameById ( $ imageIdOrRecord ) ; } $ file = new Garp_Image_File ( Garp_File :: FILE_VARIANT_UPLOAD ) ; $ src = $ file -> getUrl ( $ filename ) ; } if ( ! array_key_exists ( 'alt' , $ htmlAttribs ) ) { $ htmlAttribs [ 'alt' ] = '' ; } $ htmlAttribs [ 'src' ] = $ src ; $ imgTag = '<img' . $ this -> _htmlAttribs ( $ htmlAttribs ) . '>' ; if ( $ imageIdOrRecord instanceof Garp_Db_Table_Row ) { if ( $ partial ) { $ module = 'default' ; } else { $ partial = 'partials/image.phtml' ; $ module = 'g' ; } return $ this -> view -> partial ( $ partial , $ module , array ( 'imgTag' => $ imgTag , 'imgObject' => $ imageIdOrRecord ) ) ; } else { return $ imgTag ; } }
Returns an HTML image tag, with the correct path to the image provided.

@param mixed $imageIdOrRecord Id of the image record, or a Garp_Db_Table_Row image record.
This can also be an instance of an Image model.
If so, the image will be rendered inside a partial that
includes its caption and other metadata.
@param array $template        Template name.
@param array $htmlAttribs     HTML attributes for this <img> tag, such as 'alt'.
@param string $partial        Custom partial for rendering this image
@return string                Full image tag string, containing attributes and full path
Returns an HTML image tag with the correct path to the image provided .