Changeset View
Changeset View
Standalone View
Standalone View
branches/5.2.x/core/units/helpers/upload_helper.php
Show First 20 Lines • Show All 116 Lines • ▼ Show 20 Line(s) | |||||
* @return boolean | * @return boolean | ||||
*/ | */ | ||||
public function resizeUploadedFile(&$file_path, $format) | public function resizeUploadedFile(&$file_path, $format) | ||||
{ | { | ||||
/** @var ImageHelper $image_helper */ | /** @var ImageHelper $image_helper */ | ||||
$image_helper = $this->Application->recallObject('ImageHelper'); | $image_helper = $this->Application->recallObject('ImageHelper'); | ||||
// Add extension, so that "ImageHelper::ResizeImage" can work. | // Add extension, so that "ImageHelper::ResizeImage" can work. | ||||
$resize_file_path = tempnam(sys_get_temp_dir(), 'uploaded_') . '.jpg'; | $resize_file_path = tempnam(WRITEABLE . '/tmp', 'uploaded_') . '.jpg'; | ||||
if ( rename($file_path, $resize_file_path) === false ) { | if ( rename($file_path, $resize_file_path) === false ) { | ||||
return false; | return false; | ||||
} | } | ||||
$resized_file_path = $this->fileHelper->urlToPath( | $resized_file_path = $this->fileHelper->urlToPath( | ||||
$image_helper->ResizeImage($resize_file_path, $format) | $image_helper->ResizeImage($resize_file_path, $format) | ||||
); | ); | ||||
▲ Show 20 Lines • Show All 271 Lines • Show Last 20 Lines |