Jump to content

[SOLVED] eval help


Michdd

Recommended Posts

I'm using eval() in an image handling class that I'm writing and I seem to be having a problem with it..

 

When I do this it doesn't create a valid image resource:

 

$this->image = eval("imagecreatefrom" . $this->ext . "('" . $this->file . "');");

Where $this->ext is the mime type (png, gif, jpeg etc..) and $this->file is the filename of the image.

 

However when testing this works:

$this->image = imagecreatefromgif($this->file);

 

This doesn't seem to work either:

eval("image" . $this->ext . "('" . $this->image . "');");

But in testing this does:

imagegif($this->image);

 

I'm not sure why, am I doing something in eval incorrectly?

Link to comment
https://forums.phpfreaks.com/topic/169931-solved-eval-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.