You are here

public function MediaFlickrStreamWrapper::getLocalThumbnailPath in Media: Flickr 7.2

Same name and namespace in other branches
  1. 7 includes/MediaFlickrStreamWrapper.inc \MediaFlickrStreamWrapper::getLocalThumbnailPath()

File

includes/MediaFlickrStreamWrapper.inc, line 64
Create a Flickr Stream Wrapper class for the Media/Resource module.

Class

MediaFlickrStreamWrapper
Create an instance like this: $flickr = new MediaFlickrStreamWrapper('flickr://u/[user-code]/p/[photo-code]');

Code

public function getLocalThumbnailPath() {
  $parts = $this
    ->get_parameters();
  $local_path = str_replace('flickr://', 'public://media-flickr/', check_plain($this->uri)) . '.jpg';
  if (!file_exists($local_path)) {
    $dirname = drupal_dirname($local_path);
    file_prepare_directory($dirname, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS);
    @copy($this
      ->getOriginalThumbnailPath(), $local_path);
  }
  return $local_path;
}