Method: Scrivito::Binary#url
- Defined in:
- app/cms/scrivito/binary.rb
#url ⇒ String
Note:
The URL is calculated on demand, i.e. if the URL has not been cached yet, this method calls the Scrivito API to retrieve the URL. If you want to link to a Binary, consider using ControllerHelper#scrivito_url instead. This is generally much faster, as it performs the Scrivito API call asynchronously.
Note:
URLs for private content have an expiration time in order to protect them. Therefore, the URL should be accessed immediately after it has been returned (i.e. within a couple of minutes). Accessing it after expiration causes an error.
The URL for accessing the binary data and downloading it using an HTTP GET request.
The URLs should not be used for long-term storage since they are no longer accessible hours or days after they have been generated.
125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
# File 'app/cms/scrivito/binary.rb', line 125 def url blob_data = CmsBackend.find_blob_data(id, access_type, 'get', transformation_definition: transformation_definition) blob_data['url'] rescue ClientError => e case e.backend_code when /\Abinary\.unprocessable\.image\.transform\.source\./ raise TransformationSourceError.new(e., e.backend_code) when 'binary.unprocessable.image.transform.config.invalid' raise TransformationDefinitionError.new(e., e.backend_code) else raise e end end |