Support the ongoing development of Laravel.io →
Input Database Packages
Last updated 2 years ago.
0

php doesn't work like that. you can store php code on the db and use eval() to run it but that's a very bad practice.

what you can do is store the "variables" used in the extra syntax

// take variables from db

$source = // value from db
$x = // value from db
$y = // value from db
$limit= // value from db
$color= // value from db

$image = $manager->make($source)->fit($x, $y, null)->limitColors($limit, $color)->invert();

echo $image->response('jpg', 85);


that' simple programming stuff
Last updated 9 years ago.
0

The best approach would be to serialize your object.

Serialize your image object, put it into the database and if you want to use it again, get the string from database and deserialize it.

see: http://php.net/manual/en/language.oop5.serialization.php

0

i don't see why you have to do that? serialize and unserialize takes too much overhead and if you don't base64 encode it you won't unserialize. serializing and storing on db is a really really bad practice.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Taapo taapo Joined 18 Oct 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.