Get a placeholder image, using placehold.it by default
 @param [String] size
 @param [Hash] options
 @return [String]
10191
def image(size, options={})
      domain           = options[:domain] || 'http://placehold.it'
      src              = "#{domain}/#{size}"
      hex              = %w(a b c d e f 0 1 2 3 4 5 6 7 8 9)
      background_color = options[:background_color]
      color            = options[:color]

      if options[:random_color]
        background_color = hex.shuffle[0...6].join
        color = hex.shuffle[0...6].join
      end

      src << "/#{background_color.sub(/^#/, '')}" if background_color
      src << '/ccc' if background_color.nil? && color
      src << "/#{color.sub(/^#/, '')}" if color
      src << "&text=#{Rack::Utils.escape(options[:text])}" if options[:text]

      src
    end
1247714
def image_url(self, width=None, height=None):
        
        width_ = width or self.random_int(max=1024)
        height_ = height or self.random_int(max=1024)
        placeholder_url = self.random_element(self.image_placeholder_services)
        return placeholder_url.format(width=width_, height=height_)
84234
def responsive_image_tag(piece, options = {}, breakpoints)
        srcset = generate_srcset(piece)
        sizes = generate_sizes(piece, breakpoints)
        # Let's just use an plain image_tag if responsive styles haven't been
        # generated. We'll test for :x2000 to determine if that's the case
        if piece.image.attachment.exists?(computed_style(piece, 'x2000'))
          image_tag(piece.image.url(default_style(piece, breakpoints)), options.merge(srcset: srcset, sizes: sizes))
        else
          image_tag(piece.image.url(:_medium), options)
        end
      end
577231
def responsive_image_tag image, options={}
      # Merge any options passed with the configured options
      sizes = ResponsiveImages.options.deep_merge(options)  
      # Let's create a hash of the alternative options for our data attributes    
      data_sizes = alternative_sizes(image, sizes)
      # Get the image source
      image_src = src_path(image, sizes)      
      # Return the image tag with our responsive data attributes
      return image_tag image_src, data_sizes.merge(options)
    end
908990
def size(self, size):
        
        clone = self._clone()
        clone._size = size
        return clone
821573
def [](new_size)
      if new_size.is_a? Directive
        tags.merge! new_size.tags_for_sized_directive
      else
        tags[:size] = new_size
      end

      self
    end
1293243
def photo_sizes
      @attrs.fetch(:photo_sizes, []).each_with_object({}) do |(key, value), object|
        object[key] = Size.new(value)
      end
    end
485127
public function placeholder(array $params, $options = [])
    {
        $placeholder = null;

        $width = (isset($params['width']) && is_numeric($params['width'])) ? $params['width'] : null;
        $height = (isset($params['height']) && is_numeric($params['height'])) ? $params['height'] : null;

        if (is_null($width) || is_null($height)) {
            throw new Exception('Wrong placeholder width or height');
        }

        if (isset($params['backgroundColor']) && $this->checkHexColor($params['backgroundColor'])) {
            $backgroundColor = $params['backgroundColor'];
        } else {
            $backgroundColor = $this->options['placeholder']['backgroundColor'];
        }

        if (isset($params['textColor']) && $this->checkHexColor($params['textColor'])) {
            $textColor = $params['textColor'];
        } else {
            $textColor = $this->options['placeholder']['textColor'];
        }

        $textSize = (isset($params['textSize']) && is_numeric($params['textSize'])) ? $params['textSize'] : $this->options['placeholder']['textSize'];

        $text = !empty($params['text']) ? $params['text'] : $this->options['placeholder']['text'];
        $random = isset($params['random']) ? $params['random'] : $this->options['placeholder']['random'];

        if ($this->options['placeholder']['type'] == self::PLACEHOLDER_TYPE_URL) {
            $placeholder = $this->urlPlaceholder($width, $height, $text, $backgroundColor, $textColor, $textSize,
                $random, $options);
        } elseif ($this->options['placeholder']['type'] == self::PLACEHOLDER_TYPE_JS) {
            $placeholder = $this->jsPlaceholder($width, $height, $text, $backgroundColor, $textColor, $random, $options);
        }

        return $placeholder;
    }
1244955
def cropped_and_resized(size)
      normalized do |image|
        if record.cropped? || size != record.size
          image.crop(image_sizing.crop_geometry_string(size))
          image.resize(size)
        end
      end
    end
976948
def fetch_size fsz, &block
    obj = self.dup
    obj.instance_variable_set :@fetch_size, fsz
    ret obj, &block
  end
858854
public function thumbUrl( string $size = 'thumbnail', bool $placeholder = TRUE ) {
		if ( post_password_required( $this->ID ) ) {
			return FALSE;
		}
		$src = get_the_post_thumbnail_url( $this->ID, $size );
		if ( ! $src && $placeholder ) {
			$size = WP::getImageSize( $size );
			$text = WP::l18n("Нет+изображения");
			$src  = "http://placehold.it/{$size['width']}x{$size['height']}?text={$text}";
		}
		
		return $src;
	}
1244519
def resize(self, image, size):
        
        (width, height, force) = size

        if image.size[0] > width or image.size[1] > height:
            if force:
                return ImageOps.fit(self.image, (width, height), Image.ANTIALIAS)
            else:
                thumb = self.image.copy()
                thumb.thumbnail((width, height), Image.ANTIALIAS)
                return thumb

        return image
990699
def resize_image(self, data, size):
        
        from machina.core.compat import PILImage as Image
        image = Image.open(BytesIO(data))

        # Resize!
        image.thumbnail(size, Image.ANTIALIAS)

        string = BytesIO()
        image.save(string, format='PNG')
        return string.getvalue()
1172706
def get_cover_image(self, size=SIZE_EXTRA_LARGE):
        
        if "image" not in self.info:
            self.info["image"] = _extract_all(
                self._request(self.ws_prefix + ".getInfo", cacheable=True), "image"
            )
        return self.info["image"][size]
168694
def url(name = nil)
      if name
        if version_identifiers.include?(name.to_s)
          self[:@versions][name.to_s][:@url]
        else
          raise "Invalid Image Version identifier: '#{name}' (must be #{version_identifiers.join(', ')})"
        end
      else
        self[:@url]
      end
    end
1086332
def validate_dimensions
      return unless image?(self)

      manipulate! do |image|
        raise CarrierWave::IntegrityError, I18n.t("carrierwave.errors.image_too_big") if image.dimensions.any? { |dimension| dimension > max_image_height_or_width }
        image
      end
    end
728782
def create
      ImageScratch.where(ownable: current_user).destroy_all

      # The persistence code that follows is suboptimal.  I'm a bit tired
      # right now.  Don't see it. Needs to be fixed.  Issue should be raised.
      # TODO Raise issue here.
      ActiveRecord::Base.transaction do
        @scratch = ImageScratch.new(ownable: current_user);
        authorize! :create, @scratch
        @scratch.save!
        @scratch.image_version = ImageVersion.new(image: image_scratch_params[:image], ownable: @scratch);
        @scratch.save!
      end

    end