Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Encodes data with MIME base64
<?php base64_encode(string $string): string
<?php public function thumbnailUrl($preset = null)
{
return cp_route('assets.thumbnails.show', [
'encoded_asset' => base64_encode($this->id()),
'size' => $preset,
]);
}
<?php if ($isImage) {
$arr['thumbnail'] = cp_route('assets.thumbnails.show', [
'encoded_asset' => base64_encode($asset->id()),
'size' => 'thumbnail',
]);
}
<?php 'reference' => $this->reference(),
'permalink' => $this->absoluteUrl(),
'extension' => $this->extension(),
'downloadUrl' => cp_route('assets.download', base64_encode($this->id())),
'size' => Str::fileSizeForHumans($this->size()),
'lastModified' => $this->lastModified()->inPreferredFormat(),
'lastModifiedRelative' => $this->lastModified()->diffForHumans(),
<?php {
$permissions = $user ? $user->permissions() : [];
return base64_encode(json_encode($permissions));
}
protected function user($user)
<?php switch ($this->itemType()) {
case 'url':
$path = 'http/'.base64_encode($item);
break;
case 'asset':
$path = 'asset/'.base64_encode($this->item->containerId().'/'.$this->item->path());
<?php $path = 'http/'.base64_encode($item);
break;
case 'asset':
$path = 'asset/'.base64_encode($this->item->containerId().'/'.$this->item->path());
break;
case 'id':
$path = 'asset/'.base64_encode(str_replace('::', '/', $this->item));
<?php $path = 'asset/'.base64_encode($this->item->containerId().'/'.$this->item->path());
break;
case 'id':
$path = 'asset/'.base64_encode(str_replace('::', '/', $this->item));
break;
case 'path':
$path = URL::encode($this->item);
<?php public function testExternal()
{
$this->assertEquals(
'/img/http/'.base64_encode('http://example.com').'?w=100',
$this->builder->build('http://example.com', ['w' => '100'])
);
}
<?php $asset->container((new AssetContainer)->handle('main'));
$asset->path('img/foo.jpg');
$encoded = base64_encode('main/img/foo.jpg');
$this->assertEquals(
"/img/asset/$encoded?w=100",
<?php public function testId()
{
$encoded = base64_encode('main/img/foo.jpg');
$this->assertEquals(
"/img/asset/$encoded?w=100",