本文整理汇总了PHP中app\File::get方法的典型用法代码示例。如果您正苦于以下问题:PHP File::get方法的具体用法?PHP File::get怎么用?PHP File::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\File
的用法示例。
在下文中一共展示了File::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setMntImgAttribute
public function setMntImgAttribute($file)
{
$name = $this->sanear_string(utf8_decode($this->MNT_NOMBRE));
$this->attributes['MNT_IMG'] = 'image_' . str_replace(' ', '', $name) . '.jpg';
$nombre = 'image_' . str_replace(' ', '', $name) . '.jpg';
\Storage::disk('local')->put($nombre, \File::get($file));
}
示例2: IdentitasHandle
public function IdentitasHandle($req, $id)
{
// PDF tidak di update / melalui form
// Gagal mengupload file PDF
// Sukses Mengupload DOkumen
$temp_iden_pesan = ['error' => ['user' => 'Peringatan : File PDF tidak di atur dengan benar !', 'sistem' => 'Terjadi kesalahan upload File PDf '], 'succes' => ['store' => 'Sukses mengupload Dokumen PDF ', 'update' => 'Sukses mengupdate Dokumen PDF ']];
$temp_file_pesan = ['error' => '', 'succes' => ''];
// dd($req->all());
$file = $req->file('gambar');
if ($file and $file->getClientMimeType() == 'application/pdf') {
// dd($file);
$extension = $file->getClientOriginalExtension();
$FileIdentity = File::where('dokumen_id', $id);
// Update
if (count($FileIdentity->get()->toArray())) {
$this->result['identitas']['lama'] = $FileIdentity->get()->toArray();
//delete file
$data_for_update = ['mime' => $file->getClientMimeType(), 'original_filename' => $file->getClientOriginalName(), 'filename' => $file->getFilename() . '.' . $extension];
if ($FileIdentity->update($update)) {
$this->result['identitas']['baru'] = $FileIdentity->get()->toArray();
$this->{$result}['pesan'] = $temp_iden_pesan['succes']['update'];
// proses storage
if (\Storage::delete($FileIdentity->get()->toArray()[0]['filename']) && \Storage::disk('local')->put($file->getFilename() . '.' . $extension, \File::get($file))) {
$this->file_pesan['succes'] = $temp_file_pesan['succes'];
return true;
} else {
$this->file_pesan['error'] = $temp_file_pesan['error'];
return false;
}
return true;
} else {
return false;
}
} else {
// echo " new file";
$new_dokument = new File();
$new_dokument->dokumen_id = $id;
$new_dokument->mime = $file->getClientMimeType();
$new_dokument->original_filename = $file->getClientOriginalName();
$new_dokument->filename = $file->getFilename() . '.' . $extension;
//new identitas
if ($new_dokument->save()) {
// new pdf
if (\Storage::disk('local')->put($file->getFilename() . '.' . $extension, \File::get($file))) {
return true;
}
$this->{$result}['pesan'] = $temp_iden_pesan['succes']['store'];
return true;
} else {
$this->{$result}['pesan'] = $temp_iden_pesan['error']['sistem'];
return false;
}
}
// }
} else {
$this->{$result}['pesan'] = $temp_iden_pesan['error']['user'];
return false;
}
}
示例3: setPathAttribute
public function setPathAttribute($path)
{
if (!empty($path)) {
$name = Carbon::now()->second . $path->getClientOriginalName();
$this->attributes['path'] = $name;
\Storage::disk('local')->put($name, \File::get($path));
}
}
示例4: countries
public static function countries()
{
$countries = [];
foreach (json_decode(\File::get(storage_path('app/countries.json')), true) as $country) {
$countries[$country['code']] = $country['name'];
}
return $countries;
}
示例5: setImgUrlAttribute
public function setImgUrlAttribute($img_url)
{
if (!empty($img_url)) {
$name = Carbon::now()->second . $img_url->getClientOriginalName();
$this->attributes['img_url'] = $name;
\Storage::disk('local')->put($name, \File::get($img_url));
}
}
示例6: setFotoAttribute
public function setFotoAttribute($foto)
{
if (!empty($foto)) {
$this->attributes['foto'] = Carbon::now()->second . $foto->getClientOriginalName();
$name = Carbon::now()->second . $foto->getClientOriginalName();
\Storage::disk('local')->put($name, \File::get($foto));
}
}
示例7: setImagenAttribute
public function setImagenAttribute($imagen)
{
if (!empty($imagen)) {
$this->attributes['imagen'] = \Carbon::now()->second . $imagen->getClientOriginalName();
$filename = \Carbon::now()->second . $imagen->getClientOriginalName();
\Storage::disk('local')->put($filename, \File::get($imagen));
$thumb = \Image::make(\File::get($imagen));
$ruta = public_path() . '/uploads/noticias/thumbs/';
$thumb->resize(160, 100);
$thumb->save($ruta . 'thumb_' . $filename);
}
}
示例8: setImgUrlAttribute
/**
* @param $img_url -> nombre del archivo que quiere subir
*
**/
public function setImgUrlAttribute($img_url)
{
/*
* protección al actualizar un record
* si no se quiere actualizar la imagen, no se requiere subir una imagen y guardarla en la carpeta images
*
* si creamos un nuevo record,
* AdvertisemetRequest validará que se quiere subir una imagen para crear dicho record
*/
if (!empty($img_url)) {
/* concatena los segundos con el nombre del archivo que se subío para evitar overides */
$name = Carbon::now()->second . $img_url->getClientOriginalName();
/* renombra el archivo */
$this->attributes['img_url'] = $name;
/* almacena la imagen en nuestra caperta images */
/* \Storage::disk('local') = ruta de la carpeta images */
\Storage::disk('local')->put($name, \File::get($img_url));
}
}
示例9: setInfParrocoimgAttribute
public function setInfParrocoimgAttribute($file)
{
$this->attributes['INF_PARROCOIMG'] = 'image_parroco.jpg';
$nombre = 'image_parroco.jpg';
\Storage::disk('local')->put($nombre, \File::get($file));
}
示例10: setImagenAttribute
public function setImagenAttribute($imagen)
{
$this->attributes['imagen'] = Carbon::now()->hour . Carbon::now()->minute . Carbon::now()->second . $imagen->getClientOriginalName();
$name = Carbon::now()->hour . Carbon::now()->minute . Carbon::now()->second . $imagen->getClientOriginalName();
Storage::disk('preguntas')->put($name, \File::get($imagen));
}
示例11: SetMain_pictureAttribute
public function SetMain_pictureAttribute($main_picture)
{
$this->attributes['main_picture'] = Carbon::now()->Second . $path->getClienteOriginalName();
$name = Carbon::now()->Second . $path->getClienteOriginalName();
\Storage::diSK('local')->put($name, \File::get($main_picture));
}
示例12: __construct
public function __construct()
{
$this->books = Book::get();
$this->files = File::get();
}
示例13: setNtImagenAttribute
public function setNtImagenAttribute($file)
{
$this->attributes['NT_IMAGEN'] = 'image_' . str_replace(' ', '', date("YmdHis")) . '.jpg';
$nombre = 'image_' . str_replace(' ', '', date("YmdHis")) . '.jpg';
\Storage::disk('noticias')->put($nombre, \File::get($file));
}
示例14: getFit
public function getFit($rawOptions)
{
$options = array_only($rawOptions, ['width', 'height']);
if (empty($options)) {
return $this->getFull();
}
$fitName = $this->hash . '-' . urlencode(\GuzzleHttp\Psr7\build_query($options)) . '.' . $this->extension;
$fitPath = storage_path("images/fit/{$fitName}");
if (\File::exists($fitPath)) {
return \File::get($fitPath);
}
$img = ImageLib::make($this->getPath());
$newWidth = array_get($options, 'width', null);
$newHeight = array_get($options, 'height', null);
if ($newWidth) {
if ($newHeight) {
// both width and height
$img->fit($newWidth, $newHeight);
} else {
// Only Width
$img->widen($newWidth);
}
} else {
if ($newHeight) {
// only height
$img->heighten($newHeight);
}
}
$img->save($fitPath);
return \File::get($fitPath);
}
示例15: copyLocalToStorage
/**
* Copy the local file to Storage
*/
protected function copyLocalToStorage($localPath, $storagePath)
{
return Storage::put($storagePath, FileHelper::get($localPath), $this->isPublic() ? 'public' : null);
}