Error while resizing image upload with Laravel Image Intervention












0














I am using Laravel Image Intervention to resize an image upload field on my form.



This is the error I receive on upload - I am running on Valet.



Command (Extension) is not available for driver (Gd).


The following works fine without Image::make



      use Image;
...

$authorID = Auth::user()->id;
$file = request()->file('ts_image');
if($file) {
$file = Image::make($file)->resize(300, 300);

$fileExtension = $file->extension();
$unique_name = md5($file. time()).'.'.$fileExtension;
//
$fileImg = $file->storeAs('/public/images/' . $authorID, $unique_name);


Any ideas? Thanks!



Edit:



When dd($file) this is what is returned:



Image {#667 ▼
#driver: Driver {#668 ▼
+decoder: Decoder {#669 ▼
-data: null
}
+encoder: Encoder {#670 ▼
+result: null
+image: null
+format: null
+quality: null
}
}
#core: gd resource @16 ▼
size: "300x300"
trueColor: true
}
#backups:
+encoded: ""
+mime: "image/jpeg"
+dirname: "/private/var/tmp"
+basename: "phpBPRGuD"
+extension: null
+filename: "phpBPRGuD"
}









share|improve this question
























  • As its uploaded file it wont have an extension, from what im seeing by googling that error this and this you may need to use $file->mime() and then match it.
    – Lawrence Cherone
    Nov 11 at 20:26












  • @LawrenceCherone hmm interesting, when dd($image) I do seem to get the mime type back. See updated question.
    – scopeak
    Nov 11 at 21:01












  • Yeah as said above, extension is null so its not available, the extension method is only a getter. So you prob need to just match out the mime, though im not sure how safe it is just to trust it.
    – Lawrence Cherone
    Nov 11 at 21:05








  • 1




    np, cryptic error though as its got nothing to do with it being gd, good luck
    – Lawrence Cherone
    Nov 11 at 21:10






  • 1




    You can just create it if it does not exist i.e 3v4l.org/ERu0p
    – Lawrence Cherone
    Nov 11 at 21:21


















0














I am using Laravel Image Intervention to resize an image upload field on my form.



This is the error I receive on upload - I am running on Valet.



Command (Extension) is not available for driver (Gd).


The following works fine without Image::make



      use Image;
...

$authorID = Auth::user()->id;
$file = request()->file('ts_image');
if($file) {
$file = Image::make($file)->resize(300, 300);

$fileExtension = $file->extension();
$unique_name = md5($file. time()).'.'.$fileExtension;
//
$fileImg = $file->storeAs('/public/images/' . $authorID, $unique_name);


Any ideas? Thanks!



Edit:



When dd($file) this is what is returned:



Image {#667 ▼
#driver: Driver {#668 ▼
+decoder: Decoder {#669 ▼
-data: null
}
+encoder: Encoder {#670 ▼
+result: null
+image: null
+format: null
+quality: null
}
}
#core: gd resource @16 ▼
size: "300x300"
trueColor: true
}
#backups:
+encoded: ""
+mime: "image/jpeg"
+dirname: "/private/var/tmp"
+basename: "phpBPRGuD"
+extension: null
+filename: "phpBPRGuD"
}









share|improve this question
























  • As its uploaded file it wont have an extension, from what im seeing by googling that error this and this you may need to use $file->mime() and then match it.
    – Lawrence Cherone
    Nov 11 at 20:26












  • @LawrenceCherone hmm interesting, when dd($image) I do seem to get the mime type back. See updated question.
    – scopeak
    Nov 11 at 21:01












  • Yeah as said above, extension is null so its not available, the extension method is only a getter. So you prob need to just match out the mime, though im not sure how safe it is just to trust it.
    – Lawrence Cherone
    Nov 11 at 21:05








  • 1




    np, cryptic error though as its got nothing to do with it being gd, good luck
    – Lawrence Cherone
    Nov 11 at 21:10






  • 1




    You can just create it if it does not exist i.e 3v4l.org/ERu0p
    – Lawrence Cherone
    Nov 11 at 21:21
















0












0








0







I am using Laravel Image Intervention to resize an image upload field on my form.



This is the error I receive on upload - I am running on Valet.



Command (Extension) is not available for driver (Gd).


The following works fine without Image::make



      use Image;
...

$authorID = Auth::user()->id;
$file = request()->file('ts_image');
if($file) {
$file = Image::make($file)->resize(300, 300);

$fileExtension = $file->extension();
$unique_name = md5($file. time()).'.'.$fileExtension;
//
$fileImg = $file->storeAs('/public/images/' . $authorID, $unique_name);


Any ideas? Thanks!



Edit:



When dd($file) this is what is returned:



Image {#667 ▼
#driver: Driver {#668 ▼
+decoder: Decoder {#669 ▼
-data: null
}
+encoder: Encoder {#670 ▼
+result: null
+image: null
+format: null
+quality: null
}
}
#core: gd resource @16 ▼
size: "300x300"
trueColor: true
}
#backups:
+encoded: ""
+mime: "image/jpeg"
+dirname: "/private/var/tmp"
+basename: "phpBPRGuD"
+extension: null
+filename: "phpBPRGuD"
}









share|improve this question















I am using Laravel Image Intervention to resize an image upload field on my form.



This is the error I receive on upload - I am running on Valet.



Command (Extension) is not available for driver (Gd).


The following works fine without Image::make



      use Image;
...

$authorID = Auth::user()->id;
$file = request()->file('ts_image');
if($file) {
$file = Image::make($file)->resize(300, 300);

$fileExtension = $file->extension();
$unique_name = md5($file. time()).'.'.$fileExtension;
//
$fileImg = $file->storeAs('/public/images/' . $authorID, $unique_name);


Any ideas? Thanks!



Edit:



When dd($file) this is what is returned:



Image {#667 ▼
#driver: Driver {#668 ▼
+decoder: Decoder {#669 ▼
-data: null
}
+encoder: Encoder {#670 ▼
+result: null
+image: null
+format: null
+quality: null
}
}
#core: gd resource @16 ▼
size: "300x300"
trueColor: true
}
#backups:
+encoded: ""
+mime: "image/jpeg"
+dirname: "/private/var/tmp"
+basename: "phpBPRGuD"
+extension: null
+filename: "phpBPRGuD"
}






php laravel php-gd






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 11 at 21:00

























asked Nov 11 at 20:09









scopeak

11610




11610












  • As its uploaded file it wont have an extension, from what im seeing by googling that error this and this you may need to use $file->mime() and then match it.
    – Lawrence Cherone
    Nov 11 at 20:26












  • @LawrenceCherone hmm interesting, when dd($image) I do seem to get the mime type back. See updated question.
    – scopeak
    Nov 11 at 21:01












  • Yeah as said above, extension is null so its not available, the extension method is only a getter. So you prob need to just match out the mime, though im not sure how safe it is just to trust it.
    – Lawrence Cherone
    Nov 11 at 21:05








  • 1




    np, cryptic error though as its got nothing to do with it being gd, good luck
    – Lawrence Cherone
    Nov 11 at 21:10






  • 1




    You can just create it if it does not exist i.e 3v4l.org/ERu0p
    – Lawrence Cherone
    Nov 11 at 21:21




















  • As its uploaded file it wont have an extension, from what im seeing by googling that error this and this you may need to use $file->mime() and then match it.
    – Lawrence Cherone
    Nov 11 at 20:26












  • @LawrenceCherone hmm interesting, when dd($image) I do seem to get the mime type back. See updated question.
    – scopeak
    Nov 11 at 21:01












  • Yeah as said above, extension is null so its not available, the extension method is only a getter. So you prob need to just match out the mime, though im not sure how safe it is just to trust it.
    – Lawrence Cherone
    Nov 11 at 21:05








  • 1




    np, cryptic error though as its got nothing to do with it being gd, good luck
    – Lawrence Cherone
    Nov 11 at 21:10






  • 1




    You can just create it if it does not exist i.e 3v4l.org/ERu0p
    – Lawrence Cherone
    Nov 11 at 21:21


















As its uploaded file it wont have an extension, from what im seeing by googling that error this and this you may need to use $file->mime() and then match it.
– Lawrence Cherone
Nov 11 at 20:26






As its uploaded file it wont have an extension, from what im seeing by googling that error this and this you may need to use $file->mime() and then match it.
– Lawrence Cherone
Nov 11 at 20:26














@LawrenceCherone hmm interesting, when dd($image) I do seem to get the mime type back. See updated question.
– scopeak
Nov 11 at 21:01






@LawrenceCherone hmm interesting, when dd($image) I do seem to get the mime type back. See updated question.
– scopeak
Nov 11 at 21:01














Yeah as said above, extension is null so its not available, the extension method is only a getter. So you prob need to just match out the mime, though im not sure how safe it is just to trust it.
– Lawrence Cherone
Nov 11 at 21:05






Yeah as said above, extension is null so its not available, the extension method is only a getter. So you prob need to just match out the mime, though im not sure how safe it is just to trust it.
– Lawrence Cherone
Nov 11 at 21:05






1




1




np, cryptic error though as its got nothing to do with it being gd, good luck
– Lawrence Cherone
Nov 11 at 21:10




np, cryptic error though as its got nothing to do with it being gd, good luck
– Lawrence Cherone
Nov 11 at 21:10




1




1




You can just create it if it does not exist i.e 3v4l.org/ERu0p
– Lawrence Cherone
Nov 11 at 21:21






You can just create it if it does not exist i.e 3v4l.org/ERu0p
– Lawrence Cherone
Nov 11 at 21:21



















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53252747%2ferror-while-resizing-image-upload-with-laravel-image-intervention%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53252747%2ferror-while-resizing-image-upload-with-laravel-image-intervention%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Full-time equivalent

Bicuculline

さくらももこ