fueltank Posted October 20, 2007 Share Posted October 20, 2007 Hello everyone. I am currently working on a image generator that allows users to work with custom tags (for example something like: "<create width="300" height="200"> etc.) which gets upon sending the form put through a script that translates those tags into php code. So far, so good. Since I'm working on a image generator that will have updated information in the image frequently, I would have to go through all the tags again to create the php code which ofcourse takes a load on the processor when that has to be done each time the image gets called. Now to my question. What I would like to do is, after the user sends in the original form I would like to tranlate that form into php code (which is not the problem), and then save that php-code in a mysql database. How can I put a php-script in a mysql database and then call the db-entry and run the script? It's probably something I'm looking over... I hope someone can help me out Thank You. Link to comment https://forums.phpfreaks.com/topic/74045-saving-a-script-in-mysql/ Share on other sites More sharing options...
redarrow Posted October 20, 2007 Share Posted October 20, 2007 you use html as html hard codded on a page ... you can use html in a database but it not advised..... please look up the gd function for images it might help you to make dynamic images faster and much easer....... html in a database has bad seo .............. else use google.............. Link to comment https://forums.phpfreaks.com/topic/74045-saving-a-script-in-mysql/#findComment-373823 Share on other sites More sharing options...
fueltank Posted October 20, 2007 Author Share Posted October 20, 2007 you use html as html hard codded on a page ... you can use html in a database but it not advised..... please look up the gd function for images it might help you to make dynamic images faster and much easer....... html in a database has bad seo .............. else use google.............. Thank you for the quick response. I was thinking about putting PHP code in a mysql database. I'm not sure if that makes a different, but I'll continue my search. Thanks again. Link to comment https://forums.phpfreaks.com/topic/74045-saving-a-script-in-mysql/#findComment-373826 Share on other sites More sharing options...
liam1412 Posted October 20, 2007 Share Posted October 20, 2007 You coould just use the following $script = htmlentities($script); $script = addslashes($script); This will prevent the script from causing any problems in the db Then when you call it from the db you need use $script = stripslashes($script); $script = html_entity_decode($script); before running it. Link to comment https://forums.phpfreaks.com/topic/74045-saving-a-script-in-mysql/#findComment-373895 Share on other sites More sharing options...
Ninjakreborn Posted October 20, 2007 Share Posted October 20, 2007 What you mentioned you just need 1 table. userid imagename imageid height width Then in the name grab the path to the image, pull it out and use the height/width you databased from the user to determine the height/width specs on it. Use gd/imagemagick to do the scale downs so it doesn't lose quality during all the size changes. Link to comment https://forums.phpfreaks.com/topic/74045-saving-a-script-in-mysql/#findComment-373968 Share on other sites More sharing options...
fueltank Posted October 20, 2007 Author Share Posted October 20, 2007 You coould just use the following $script = htmlentities($script); $script = addslashes($script); This will prevent the script from causing any problems in the db Then when you call it from the db you need use $script = stripslashes($script); $script = html_entity_decode($script); before running it. Thank you. But when I generate a php code from all these tags (the <create .....> was just an example, there are a few more) how would I get that php-code into a variable to be able to save it in a db? Example Code: header("Content-type: image/png"); $im = @imagecreate(100, 300); $font = "./fonts/verdana.TTF"; $black = imagecolorallocate($im, 0, 0, 0); imagettftext($im, 10, 0, 18, 21, $black, $font, "some text"); imagepng($im); (I've just put that code together, not sure if it even works). When I generate a code like that, how do I get it into a single variable (+ in the database)? Thank you again. Link to comment https://forums.phpfreaks.com/topic/74045-saving-a-script-in-mysql/#findComment-374106 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.