- Модуль: main
- Путь к файлу: ~/bitrix/modules/main/lib/ui/uploader/storage.php
- Класс: BitrixMainUIUploaderCloudStorage
- Вызов: CloudStorage::copy
public function copy($path, array $file)
{
$result = parent::copy($path, $file);
if ($result->isSuccess())
{
if (!array_key_exists('start', $file))
{
$res = $result->getData();
$file["tmp_name"] = $res["tmp_name"];
$file["size"] = $res["size"];
$file["type"] = $res["type"];
$info = (new BitrixMainFileImage($file["tmp_name"]))->getInfo();
if($info)
{
$file["width"] = $info->getWidth();
$file["height"] = $info->getHeight();
}
else
{
$file["width"] = 0;
$file["height"] = 0;
}
if ($bucket = $this->findBucket($file))
{
unset($file["count"]);
if (($r = $this->moveIntoCloud($bucket, $file["tmp_name"], $file)) && $r->isSuccess())
{
$res = $r->getData();
$result->setData(array(
"size" => $file["size"],
"file_size" => $file["size"],
"tmp_name" => $res["tmp_name"],
"type" => $file["type"],
"width" => $file["width"],
"height" => $file["height"],
"bucketId" => $bucket->ID
));
}
if ($r->getErrors())
{
$result->addErrors($r->getErrors());
}
@unlink($path);
}
}
else if ($file["start"] <= 0)
{
$res = $result->getData();
if (($info = (new BitrixMainFileImage($file["tmp_name"]))->getInfo()))
{
$file["width"] = $info->getWidth();
$file["height"] = $info->getHeight();
$result->setData(array_merge($res, ["width" => $file["width"], "height" => $file["height"]]));
}
}
}
return $result;
}