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 기반 앱

AI Clothes Remover
사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

AI Hentai Generator
AI Hentai를 무료로 생성하십시오.

인기 기사

뜨거운 도구

SublimeText3 영어 버전
권장 사항: Win 버전, 코드 프롬프트 지원!

맨티스BT
Mantis는 제품 결함 추적을 돕기 위해 설계된 배포하기 쉬운 웹 기반 결함 추적 도구입니다. PHP, MySQL 및 웹 서버가 필요합니다. 데모 및 호스팅 서비스를 확인해 보세요.

mPDF
mPDF는 UTF-8로 인코딩된 HTML에서 PDF 파일을 생성할 수 있는 PHP 라이브러리입니다. 원저자인 Ian Back은 자신의 웹 사이트에서 "즉시" PDF 파일을 출력하고 다양한 언어를 처리하기 위해 mPDF를 작성했습니다. HTML2FPDF와 같은 원본 스크립트보다 유니코드 글꼴을 사용할 때 속도가 느리고 더 큰 파일을 생성하지만 CSS 스타일 등을 지원하고 많은 개선 사항이 있습니다. RTL(아랍어, 히브리어), CJK(중국어, 일본어, 한국어)를 포함한 거의 모든 언어를 지원합니다. 중첩된 블록 수준 요소(예: P, DIV)를 지원합니다.

SublimeText3 Mac 버전
신 수준의 코드 편집 소프트웨어(SublimeText3)

SublimeText3 Linux 새 버전
SublimeText3 Linux 최신 버전
