当前位置: 首页>>代码示例>>PHP>>正文


PHP input::getClientOriginalName方法代码示例

本文整理汇总了PHP中input::getClientOriginalName方法的典型用法代码示例。如果您正苦于以下问题:PHP input::getClientOriginalName方法的具体用法?PHP input::getClientOriginalName怎么用?PHP input::getClientOriginalName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在input的用法示例。


在下文中一共展示了input::getClientOriginalName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: uploadImagesProcess

/**
 * Upload Proccess Function
 * @param  input    $file                       Get upload file
 * @param  string   $destinationPath            Set destination path
 * @param  digit    $destinationWidth           Set destination image width
 * @param  digit    $destinationHeight          Set destination image height
 * @param  digit    $destinationRetinaWidth     Set destination retina image width
 * @param  digit    $destinationRetinaHeight    Set destination retina image height
 * @param  string   $thumbnailsPath             Set thumbnails path
 * @param  digit    $thumbnailsWidth            Set thumbnails image width
 * @param  digit    $thumbnailsHeight           Set thumbnails image height
 * @param  digit    $thumbnailsRetinaWidth      Set thumbnails retina width
 * @param  digit    $thumbnailsRetinaHeight     Set thumbnails retina height
 * @return string   $normal_name                Return uploaded file name
 */
function uploadImagesProcess($file, $destinationPath, $destinationWidth, $destinationHeight, $destinationRetinaWidth, $destinationRetinaHeight, $thumbnailsPath, $thumbnailsWidth, $thumbnailsHeight, $thumbnailsRetinaWidth, $thumbnailsRetinaHeight)
{
    $ext = $file->guessClientExtension();
    // Get real extension according to mime type
    $fullname = $file->getClientOriginalName();
    // Client file name, including the extension of the client
    $hashname = date('H.i.s') . '-' . md5($fullname);
    // Hash processed file name, including the real extension
    $normal_name = $hashname . '.' . $ext;
    $retina_name = $hashname . '@2x.' . $ext;
    $picture = Image::make($file->getRealPath());
    // crop the best fitting ratio and resize image
    $picture->fit($destinationWidth, $destinationHeight)->save(public_path($destinationPath . $normal_name));
    $picture->fit($destinationRetinaWidth, $destinationRetinaHeight)->save(public_path($destinationPath . $retina_name));
    $picture->fit($thumbnailsWidth, $thumbnailsHeight)->save(public_path($thumbnailsPath . $normal_name));
    $picture->fit($thumbnailsRetinaWidth, $thumbnailsRetinaHeight)->save(public_path($thumbnailsPath . $retina_name));
    return $normal_name;
}
开发者ID:rimshavbase,项目名称:timefragment,代码行数:33,代码来源:functions.php


注:本文中的input::getClientOriginalName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。