Dynamic image generation - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Dynamic image generation (/showthread.php?tid=29697) Pages:
1
2
|
Dynamic image generation - El Forum - 04-18-2010 [eluser]Mat-Moo[/eluser] I've got a basic form with a couple of text fields that the user can enter text, and a routine that takes the text and turns it into an image. I've been trying to figure out how make this a ajax type thing so that they can click a preview button, and a new image is drawn on the screen... but I'm stumped. I need to send the form data via post and tried jquery / ajax / post but I can't figure out how to actually update the image. I've also tried just having an iframe and updating that, but for some reason this screws up my session data and after a couple of minutes of inactivity I get logged out (Site works fine otherwise).... I hope someone can give me some clues/pointers, or code to hepl me out! TIA Dynamic image generation - El Forum - 04-18-2010 [eluser]vitoco[/eluser] with jquery - first, you must have a div to load the image, for example Code: <div id="dynamic_image"></div> Code: [removed] Code: <img src="/images/temp/XXXXX.gif"/> Saludos Dynamic image generation - El Forum - 04-19-2010 [eluser]Mat-Moo[/eluser] So in the dynamic image create I can't just send the output of the generated file? This is what I was trying to avoid, otherwise I've pretty much done exactly what you said. Thanks for the input! Dynamic image generation - El Forum - 04-19-2010 [eluser]vitoco[/eluser] ok...if you're using the jquery form plugin, after the server send the response, you may update the image by "reloading" their source attribute, and in order to this work over the cache, add a random number to the end, like this Code: ... Saludos Dynamic image generation - El Forum - 04-19-2010 [eluser]Mat-Moo[/eluser] Same thing no? Still got to create the image in "file_to_create_the_image.php" which has the post data? Dynamic image generation - El Forum - 04-19-2010 [eluser]vitoco[/eluser] [quote author="Mat-Moo" date="1271685584"]Same thing no? Still got to create the image in "file_to_create_the_image.php" which has the post data?[/quote] Obviously, in order to "preview" the image, you must create it in the server according to the values passed thought the form via ajax, and then load that image in the client, either loading html code o refreshing the source attribute, that's what you need to ( and want to ) do??? , if not, i didn't understand your approach. Dynamic image generation - El Forum - 04-19-2010 [eluser]Mat-Moo[/eluser] I guess I'll have to create and cache the dynamic image, I was tring to send the image straight back with header/ImageJpg, but I can't see how I can get that to work. Dynamic image generation - El Forum - 04-19-2010 [eluser]Mat-Moo[/eluser] Code: set_message("ok","Creating preview, please wait..."); Dynamic image generation - El Forum - 04-19-2010 [eluser]vitoco[/eluser] i just realize what you were trying to do, and maybe this may work; Code: ... And in the controller/method , first , get the text to render in the image from uri_segments , then return the image with the image/jpg header. Saludos Dynamic image generation - El Forum - 04-19-2010 [eluser]Mat-Moo[/eluser] I thought about using get, but the text could contain ? & or anything which could cause issues with CI, hence why using post. |