You are here

protected function Textimage::buildUri in Textimage 7.3

Set URI to image file.

If file name is human readable, then image would go to:

{style_wrapper}://textimage/{style}/{file name}.{extension}

in all other cases, an appropriate directory structure is in place to support styled, unstyled and uncached (temporary) image files:

for images with a supporting image style (styled) - {textimage_store_wrapper}://textimage_store/styled_hashed/{style}/{file name}.{extension}

for images generated via direct theme (unstyled) - {textimage_store_wrapper}://textimage_store/unstyled_hashed/{file name}.{extension}

for uncached, temporary - {textimage_store_wrapper}://textimage_store/uncached/{file name}.{extension}

1 call to Textimage::buildUri()
Textimage::buildImage in classes/Textimage.inc
Build the image via core image_style_create_derivative() function.

File

classes/Textimage.inc, line 609
Textimage - Textimage class.

Class

Textimage
@file Textimage - Textimage class.

Code

protected function buildUri() {

  // If style and caching are set, then try a clear file uri.
  if ($this->style && $this->caching && !$this->forceHashedFilename && $this
    ->getStyledImageClearFileUri()) {
    return;
  }

  // Otherwise, the hash will be the file name, and files stored in
  // textimage_store.
  if ($this->caching) {
    $base_name = $this->id . '.' . $this->extension;
    if ($this->style) {
      $this->uri = _textimage_get_store_path('styled_hashed/') . $this->style['name'] . '/' . $base_name;
    }
    else {
      $this->uri = _textimage_get_store_path('unstyled_hashed/') . $base_name;
    }
  }
  else {
    $base_name = md5(session_id() . microtime()) . '.' . $this->extension;
    $this->uri = _textimage_get_store_path('uncached/') . $base_name;
  }
}