Laravel response resource png Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) Data science time! April 2019 and salary with experience Should we burninate the [wrap] tag? The Ask Question Wizard is Live!mysql_fetch_array()/mysql_fetch_assoc()/mysql_fetch_row()/mysql_num_rows etc… expects parameter 1 to be resource or resultphp compressing images showing varying resultsPHP HELP: (the image “bla bla” cannot be displayed because it contains errorsAdd new methods to a resource controller in LaravelLaravel requires the Mcrypt PHP extensionLaravel 4 Eloquent Query Using WHERE with OR AND OR?How to Create Multiple Where Clause Query Using Laravel Eloquent?Get the Last Inserted Id Using Laravel EloquentBest Practices for Custom Helpers in Laravel 5PHP Eventviva enlarges transparent png

String `!23` is replaced with `docker` in command line

What does "fit" mean in this sentence?

Why was the term "discrete" used in discrete logarithm?

Is the Standard Deduction better than Itemized when both are the same amount?

Why didn't this character "real die" when they blew their stack out in Altered Carbon?

How does the particle を relate to the verb 行く in the structure「A を + B に行く」?

Withdrew £2800, but only £2000 shows as withdrawn on online banking; what are my obligations?

Why do people hide their license plates in the EU?

Seeking colloquialism for “just because”

Extract all GPU name, model and GPU ram

Generate an RGB colour grid

Why is my conclusion inconsistent with the van't Hoff equation?

Resolving to minmaj7

When do you get frequent flier miles - when you buy, or when you fly?

Why did the Falcon Heavy center core fall off the ASDS OCISLY barge?

How to run gsettings for another user Ubuntu 18.04.2 LTS

Using audio cues to encourage good posture

How to find out what spells would be useless to a blind NPC spellcaster?

Bete Noir -- no dairy

Should I use a zero-interest credit card for a large one-time purchase?

What is Arya's weapon design?

Is it true that "carbohydrates are of no use for the basal metabolic need"?

Identifying polygons that intersect with another layer using QGIS?

How to find all the available tools in mac terminal?



Laravel response resource png



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
Data science time! April 2019 and salary with experience
Should we burninate the [wrap] tag?
The Ask Question Wizard is Live!mysql_fetch_array()/mysql_fetch_assoc()/mysql_fetch_row()/mysql_num_rows etc… expects parameter 1 to be resource or resultphp compressing images showing varying resultsPHP HELP: (the image “bla bla” cannot be displayed because it contains errorsAdd new methods to a resource controller in LaravelLaravel requires the Mcrypt PHP extensionLaravel 4 Eloquent Query Using WHERE with OR AND OR?How to Create Multiple Where Clause Query Using Laravel Eloquent?Get the Last Inserted Id Using Laravel EloquentBest Practices for Custom Helpers in Laravel 5PHP Eventviva enlarges transparent png



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I'm currently trying to reproduce a PNG in Laravel as a response which is only presented to me as a data type resource.
And although I read the textures of a Minecraft skin and want to render the head of the player, I can't get the content to be recognized as PNG. If I want to display the image as a response via Laravel he always complains about the type and if I let it be displayed with imagepng it is not available as a real mimetype in the browser.
Code below



Head Method:



public static function head($rawSkin, $scale = 1, $vertRot = 0, $horRot = 0, $helmet = true)
imagesavealpha($rawSkin, true);
//we don't need create new **transparent** image because we use the full image size
$canvas = imagecreatetruecolor(self::HEAD_SIZE * $scale, self::HEAD_SIZE * $scale);
imagecopyresampled($canvas, $rawSkin, 0 * $scale, 0 * $scale, 8, 8
, self::HEAD_SIZE * $scale, self::HEAD_SIZE * $scale, 8, 8);
return $canvas;



Skinload Method:



 private function getImage($uuid)
$result = file_get_contents("https://sessionserver.mojang.com/session/minecraft/profile/".$uuid);
$result = json_decode($result);
$textures = $result->properties[0]->value;
$textures = json_decode(base64_decode($textures));
return imagecreatefrompng($textures->textures->SKIN->url);



Response Method:



function renderHeadByUUID(Request $request)
if(isset($request->uuid))
header("Content-type: image/png");
imagepng(MinecraftSkins::head($this->getImage($request->uuid)));











share|improve this question






















  • Can you show your error message please

    – Jonathan K
    Mar 8 at 18:13











  • with this code there is no errormsg only he does not set the mime type

    – Letsplaybar
    Mar 8 at 18:31











  • But when I execute return response(MinecraftSkins::head($this->getImage($request->uuid)))->header(header('Content-Type', 'image/png')); the mistake comes "UnexpectedValueException The Response content must be a string or object implementing __toString(), "resource" given." And unfortunately I can't find a way to get a Laravel response from the resource.

    – Letsplaybar
    Mar 8 at 18:36












  • Try to encrypt your content before passing it to response. Encrypt your outgoing image content in base64_encode($img_src)

    – Jonathan K
    Mar 8 at 18:39











  • "base64_encode() expects parameter 1 to be string, resource given" self Problem

    – Letsplaybar
    Mar 8 at 19:00

















0















I'm currently trying to reproduce a PNG in Laravel as a response which is only presented to me as a data type resource.
And although I read the textures of a Minecraft skin and want to render the head of the player, I can't get the content to be recognized as PNG. If I want to display the image as a response via Laravel he always complains about the type and if I let it be displayed with imagepng it is not available as a real mimetype in the browser.
Code below



Head Method:



public static function head($rawSkin, $scale = 1, $vertRot = 0, $horRot = 0, $helmet = true)
imagesavealpha($rawSkin, true);
//we don't need create new **transparent** image because we use the full image size
$canvas = imagecreatetruecolor(self::HEAD_SIZE * $scale, self::HEAD_SIZE * $scale);
imagecopyresampled($canvas, $rawSkin, 0 * $scale, 0 * $scale, 8, 8
, self::HEAD_SIZE * $scale, self::HEAD_SIZE * $scale, 8, 8);
return $canvas;



Skinload Method:



 private function getImage($uuid)
$result = file_get_contents("https://sessionserver.mojang.com/session/minecraft/profile/".$uuid);
$result = json_decode($result);
$textures = $result->properties[0]->value;
$textures = json_decode(base64_decode($textures));
return imagecreatefrompng($textures->textures->SKIN->url);



Response Method:



function renderHeadByUUID(Request $request)
if(isset($request->uuid))
header("Content-type: image/png");
imagepng(MinecraftSkins::head($this->getImage($request->uuid)));











share|improve this question






















  • Can you show your error message please

    – Jonathan K
    Mar 8 at 18:13











  • with this code there is no errormsg only he does not set the mime type

    – Letsplaybar
    Mar 8 at 18:31











  • But when I execute return response(MinecraftSkins::head($this->getImage($request->uuid)))->header(header('Content-Type', 'image/png')); the mistake comes "UnexpectedValueException The Response content must be a string or object implementing __toString(), "resource" given." And unfortunately I can't find a way to get a Laravel response from the resource.

    – Letsplaybar
    Mar 8 at 18:36












  • Try to encrypt your content before passing it to response. Encrypt your outgoing image content in base64_encode($img_src)

    – Jonathan K
    Mar 8 at 18:39











  • "base64_encode() expects parameter 1 to be string, resource given" self Problem

    – Letsplaybar
    Mar 8 at 19:00













0












0








0








I'm currently trying to reproduce a PNG in Laravel as a response which is only presented to me as a data type resource.
And although I read the textures of a Minecraft skin and want to render the head of the player, I can't get the content to be recognized as PNG. If I want to display the image as a response via Laravel he always complains about the type and if I let it be displayed with imagepng it is not available as a real mimetype in the browser.
Code below



Head Method:



public static function head($rawSkin, $scale = 1, $vertRot = 0, $horRot = 0, $helmet = true)
imagesavealpha($rawSkin, true);
//we don't need create new **transparent** image because we use the full image size
$canvas = imagecreatetruecolor(self::HEAD_SIZE * $scale, self::HEAD_SIZE * $scale);
imagecopyresampled($canvas, $rawSkin, 0 * $scale, 0 * $scale, 8, 8
, self::HEAD_SIZE * $scale, self::HEAD_SIZE * $scale, 8, 8);
return $canvas;



Skinload Method:



 private function getImage($uuid)
$result = file_get_contents("https://sessionserver.mojang.com/session/minecraft/profile/".$uuid);
$result = json_decode($result);
$textures = $result->properties[0]->value;
$textures = json_decode(base64_decode($textures));
return imagecreatefrompng($textures->textures->SKIN->url);



Response Method:



function renderHeadByUUID(Request $request)
if(isset($request->uuid))
header("Content-type: image/png");
imagepng(MinecraftSkins::head($this->getImage($request->uuid)));











share|improve this question














I'm currently trying to reproduce a PNG in Laravel as a response which is only presented to me as a data type resource.
And although I read the textures of a Minecraft skin and want to render the head of the player, I can't get the content to be recognized as PNG. If I want to display the image as a response via Laravel he always complains about the type and if I let it be displayed with imagepng it is not available as a real mimetype in the browser.
Code below



Head Method:



public static function head($rawSkin, $scale = 1, $vertRot = 0, $horRot = 0, $helmet = true)
imagesavealpha($rawSkin, true);
//we don't need create new **transparent** image because we use the full image size
$canvas = imagecreatetruecolor(self::HEAD_SIZE * $scale, self::HEAD_SIZE * $scale);
imagecopyresampled($canvas, $rawSkin, 0 * $scale, 0 * $scale, 8, 8
, self::HEAD_SIZE * $scale, self::HEAD_SIZE * $scale, 8, 8);
return $canvas;



Skinload Method:



 private function getImage($uuid)
$result = file_get_contents("https://sessionserver.mojang.com/session/minecraft/profile/".$uuid);
$result = json_decode($result);
$textures = $result->properties[0]->value;
$textures = json_decode(base64_decode($textures));
return imagecreatefrompng($textures->textures->SKIN->url);



Response Method:



function renderHeadByUUID(Request $request)
if(isset($request->uuid))
header("Content-type: image/png");
imagepng(MinecraftSkins::head($this->getImage($request->uuid)));








php laravel minecraft






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 8 at 17:44









LetsplaybarLetsplaybar

42110




42110












  • Can you show your error message please

    – Jonathan K
    Mar 8 at 18:13











  • with this code there is no errormsg only he does not set the mime type

    – Letsplaybar
    Mar 8 at 18:31











  • But when I execute return response(MinecraftSkins::head($this->getImage($request->uuid)))->header(header('Content-Type', 'image/png')); the mistake comes "UnexpectedValueException The Response content must be a string or object implementing __toString(), "resource" given." And unfortunately I can't find a way to get a Laravel response from the resource.

    – Letsplaybar
    Mar 8 at 18:36












  • Try to encrypt your content before passing it to response. Encrypt your outgoing image content in base64_encode($img_src)

    – Jonathan K
    Mar 8 at 18:39











  • "base64_encode() expects parameter 1 to be string, resource given" self Problem

    – Letsplaybar
    Mar 8 at 19:00

















  • Can you show your error message please

    – Jonathan K
    Mar 8 at 18:13











  • with this code there is no errormsg only he does not set the mime type

    – Letsplaybar
    Mar 8 at 18:31











  • But when I execute return response(MinecraftSkins::head($this->getImage($request->uuid)))->header(header('Content-Type', 'image/png')); the mistake comes "UnexpectedValueException The Response content must be a string or object implementing __toString(), "resource" given." And unfortunately I can't find a way to get a Laravel response from the resource.

    – Letsplaybar
    Mar 8 at 18:36












  • Try to encrypt your content before passing it to response. Encrypt your outgoing image content in base64_encode($img_src)

    – Jonathan K
    Mar 8 at 18:39











  • "base64_encode() expects parameter 1 to be string, resource given" self Problem

    – Letsplaybar
    Mar 8 at 19:00
















Can you show your error message please

– Jonathan K
Mar 8 at 18:13





Can you show your error message please

– Jonathan K
Mar 8 at 18:13













with this code there is no errormsg only he does not set the mime type

– Letsplaybar
Mar 8 at 18:31





with this code there is no errormsg only he does not set the mime type

– Letsplaybar
Mar 8 at 18:31













But when I execute return response(MinecraftSkins::head($this->getImage($request->uuid)))->header(header('Content-Type', 'image/png')); the mistake comes "UnexpectedValueException The Response content must be a string or object implementing __toString(), "resource" given." And unfortunately I can't find a way to get a Laravel response from the resource.

– Letsplaybar
Mar 8 at 18:36






But when I execute return response(MinecraftSkins::head($this->getImage($request->uuid)))->header(header('Content-Type', 'image/png')); the mistake comes "UnexpectedValueException The Response content must be a string or object implementing __toString(), "resource" given." And unfortunately I can't find a way to get a Laravel response from the resource.

– Letsplaybar
Mar 8 at 18:36














Try to encrypt your content before passing it to response. Encrypt your outgoing image content in base64_encode($img_src)

– Jonathan K
Mar 8 at 18:39





Try to encrypt your content before passing it to response. Encrypt your outgoing image content in base64_encode($img_src)

– Jonathan K
Mar 8 at 18:39













"base64_encode() expects parameter 1 to be string, resource given" self Problem

– Letsplaybar
Mar 8 at 19:00





"base64_encode() expects parameter 1 to be string, resource given" self Problem

– Letsplaybar
Mar 8 at 19:00












0






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%2f55068381%2flaravel-response-resource-png%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






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.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55068381%2flaravel-response-resource-png%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

1928 у кіно

Захаров Федір Захарович

Ель Греко