DaveLinger Posted August 14, 2006 Share Posted August 14, 2006 so I have this dynamic image creation script, but obviously when people go to save it it tries to save it as .php instead of the png that it is, and many forums do not allow them to use these images because the extension is php... is there any way to get it to output to .png apart from saving each person's generated image to the server or making php process any .png image files? Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted August 14, 2006 Share Posted August 14, 2006 Only thing I can think of is providing a link next to the image. When they click that link create the image and save it into a temp folder and allow them to save that image.Clear you temp folder of images older than 1 hour every hour (or day or what ever) with a cron job. Quote Link to comment Share on other sites More sharing options...
onlyican Posted August 14, 2006 Share Posted August 14, 2006 U can use header(); function setting the MIME types to png instead of standard phpThis should work well Quote Link to comment Share on other sites More sharing options...
DaveLinger Posted August 14, 2006 Author Share Posted August 14, 2006 [quote author=onlyican link=topic=104202.msg415459#msg415459 date=1155566243]U can use header(); function setting the MIME types to png instead of standard phpThis should work well[/quote]I already do that, but the extension of the file is still php, so thats what the browser tries to save it as. Quote Link to comment Share on other sites More sharing options...
Chetan Posted August 14, 2006 Share Posted August 14, 2006 Well unless you also want to parse png files in PHP here is how you do it.The place in apaches conf where you set which extensions should be parsed in PHP put png, jpg, gifand write image code in png to return a png file which can be saved.So you see you cant do it unless you wanna parse image files which only the server admin can do which i guess is not you Quote Link to comment Share on other sites More sharing options...
Chetan Posted August 15, 2006 Share Posted August 15, 2006 I just found out that, In IE when u use save picture as it saves as the type not .php and also when you save the document it saves a web page with the pic.I dint use that code from GD but another script which takes pictures from MySQL Quote Link to comment Share on other sites More sharing options...
tangazacom Posted August 15, 2006 Share Posted August 15, 2006 You can also create an Object buffer , Imagepng($im,'',50); ob_start(); Imagepng($im,'',50); $image_data = ob_get_contents(); // get the buffer into a variable ob_end_clean(); // discard the buffer ImageDestroy ($im);then use $image_data as you like. Cheers,ECD @ Tangaza.com(www.tangaza.com) Quote Link to comment Share on other sites More sharing options...
dwees Posted October 17, 2006 Share Posted October 17, 2006 This is exactly the same problem I'm having. The person who replied last said something about using the object buffer, but I'm really not sure exactly how this helps. I know I call the image using the php script that creates the image as the image source, but I'd like the saveas option to have a .png instead of .php (for browsers like Firefox that don't check the filetype when doing the saveas, and instead just check the src="image.php").How do I do this? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.