FROM?http://stackoverflow.com/questions/16736196/how-to-use-redactor-image-upload-in-laravel-4 I am trying to use Redactor with Laravel4. I can succesfully edit my textarea but I cant get to work with image uploads. When I try to upload a
FROM?http://stackoverflow.com/questions/16736196/how-to-use-redactor-image-upload-in-laravel-4
I am trying to use Redactor with Laravel4. I can succesfully edit my textarea but I cant get to work with image uploads. When I try to upload a file I get 500 error and In developer tools , I can see
Request URL:http://projemiz.dev/admin/blogs/3/postimage/3
This is my link for redactor photo upload:
$('#editor').redactor({ imageUpload: "postimage/{{$post->id}}"});
My routes are inside prefixes :
# Blog Management Route::group(array('prefix' => 'blogs'), function() { Route::get('/', array('as' => 'blogs', 'uses' => 'Controllers\Admin\BlogsController@getIndex')); Route::get('create', array('as' => 'create/blog', 'uses' => 'Controllers\Admin\BlogsController@getCreate')); Route::post('create', 'Controllers\Admin\BlogsController@postCreate'); Route::get('{blogId}/edit', array('as' => 'update/blog', 'uses' => 'Controllers\Admin\BlogsController@getEdit')); Route::post('{blogId}/edit', 'Controllers\Admin\BlogsController@postEdit'); Route::post('{blogId}/postimage','Controllers\Admin\BlogsController@postImage'); Route::get('{blogId}/delete', array('as' => 'delete/blog', 'uses' => 'Controllers\Admin\BlogsController@getDelete')); });
and my controller is :
public function postImage($blogId) { $path = base_path().'/public/uploads/img/posts/' . (int)$blogId; $image = Input::file('photo'); if (Input::hasFile('photo')) { $fileName = $file->getClientOriginalName(); $image->move($path,$fileName); $image = new Image; $image->name = $fileName.name; $image->save(); // resizing an uploaded file Image::make($image->getRealPath())->resize(300, 200)->save($path.'thumb-'.$fileName); Image::make($image->getRealPath())->resize(300, 200)->save($path.'thumb-'.$fileName); //File::delete( $path . '/' . Input::file('file.name'));*/ } }
Can anyone help me to fix my link inside redactor?
Try changing your js-script this:
$('#editor').redactor({ imageUpload: "/{{$post->id}}/postimage"});
In the upload function return the path of the image after upload
public function postImage($blogId) { $path = base_path().'/public/uploads/img/posts/' . (int)$blogId; $image = Input::file('photo'); if (Input::hasFile('photo')) { $fileName = $file->getClientOriginalName(); $image->move($path,$fileName); $image = new Image; $image->name = $fileName.name; $image->save(); // resizing an uploaded file Image::make($image->getRealPath())->resize(300, 200)->save($path.'thumb-'.$fileName); Image::make($image->getRealPath())->resize(300, 200)->save($path.'thumb-'.$fileName); // Return Image path as JSON if ($file->move($path, $fileName)) { return Response::json(array('filelink' => $path . '/' . $fileName)); } } }
原文地址:How to use Redactor image upload in laravel 4?, 感谢原作者分享。

本文将介绍七种利用免费的BingImageCreator获得高质量输出的方法。BingImageCreator(现称为MicrosoftDesigner的ImageCreator)是一个出色的在线人工智能艺术生成器之一。它能根据用户的提示生成高度逼真的视觉效果。提示越具体、清晰和创意,生成的效果也会更出色。BingImageCreator在创建高质量图像方面取得了重大进展。它现在使用Dall-E3培训模式,显示出更高水平的细节和现实主义。然而,它能否始终如一地生成高清结果取决于几个因素,包括快速

小米手机image怎么删除?在小米手机中是可以删除image,但是多数的用户不知道image如何的删除,接下来就是小编为用户带来的小米手机image删除方法教程,感兴趣的用户快来一起看看吧!小米手机image怎么删除1、首先打开小米手机中的【相册】功能;2、然后勾选不需要的图片,点击右下角的【删除】按钮;3、之后点击最顶部的【相册】进入到专区,选择【回收站】;4、接着直接点击下图所示的【清空回收站】;5、最后直接点击【永久删除】即可完成。

LINUX是一种开源的操作系统,它的灵活性和可定制性使得它成为了许多开发者和系统管理员的首选,在LINUX系统中,图像处理是一个非常重要的任务,而Imagemagick和Image是两个非常流行的图像处理工具,本文将为您介绍如何在Centos系统中安装Imagemagick和Image,并提供详细的安装教程。Imagemagic安装Centos教程Imagemagick是一个功能强大的图像处理工具集,它可以在命令行下执行各种图像操作,以下是在Centos系统上安装Imagemagick的步骤:1

imagefilledrectangle()函数绘制一个填充矩形。语法imagefilledrectangle($img,$x1,$y1,$x2,$y2,$color)参数image 使用imagecreatetruecolor()创建一个空白图像。x1点1的x坐标。y1 点1的y坐标。x2 点2的x坐标。y2 点2的y坐标。color 填充颜色。返回值imagefilledrectangle()函数成功返

如何使用PHP7的NameSpace和Use关键字组织代码的结构?引言:在软件开发中,代码的组织结构是非常重要的,它直接关系到代码的可读性、可维护性和可扩展性。随着PHP版本的不断迭代,PHP7引入了NameSpace和Use关键字,这为我们提供了更多灵活性和便利性。本文将介绍如何使用PHP7的NameSpace和Use关键字来组织代码的结构,并提供具体的代

php use类找不到的解决办法:1、打开相应的PHP文件;2、将use语句插入每个文件;3、执行“class_alias('RedBean_Facade', 'R');”代码即可。

如何利用PHP7的namespace和use关键字组织代码的结构?在编写大型项目时,代码的结构化和组织是非常重要的。PHP7引入了namespace和use关键字,帮助我们更好地管理代码的命名空间,提高代码的可读性和可维护性。本文将介绍如何利用PHP7的namespace和use关键字优化代码结构,并附带具体的代码示例。创建命名空间命名空间通过将一组相关的类

According to the latest information from Board Channels,Nvidia will begin shipping a new variant of the GeForce RTX 4070(approx. $530 on Amazon) on August 20, which is equipped with GDDR6 instead of GDDR6X graphics memory. This should allow the graph


熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

AI Hentai Generator
免費產生 AI 無盡。

熱門文章

熱工具

Safe Exam Browser
Safe Exam Browser是一個安全的瀏覽器環境,安全地進行線上考試。該軟體將任何電腦變成一個安全的工作站。它控制對任何實用工具的訪問,並防止學生使用未經授權的資源。

ZendStudio 13.5.1 Mac
強大的PHP整合開發環境

MinGW - Minimalist GNU for Windows
這個專案正在遷移到osdn.net/projects/mingw的過程中,你可以繼續在那裡關注我們。 MinGW:GNU編譯器集合(GCC)的本機Windows移植版本,可自由分發的導入函式庫和用於建置本機Windows應用程式的頭檔;包括對MSVC執行時間的擴展,以支援C99功能。 MinGW的所有軟體都可以在64位元Windows平台上運作。

SublimeText3漢化版
中文版,非常好用

EditPlus 中文破解版
體積小,語法高亮,不支援程式碼提示功能