Jump to content

GD help when saving file


hlstriker

Recommended Posts

I am creating images via GD perfectly but there is only one problem.

 

When I right click the image and click "Save image as...", the filename will be 'image.php.jpeg'.

 

Is there a way I can make this display as only 'image.jpeg'?

 

I'm not sure but there must be a GD library function, which allows us to set the name of the image.

Link to comment
Share on other sites

when I "Save as.." the filename is in an editable text field, and I can change it.  As in, remove the current extension, so it only saves as blah.jpg.  If for some reason you can't do that, you can rename it after the file is saved, by rightclick > rename or rightclick > properties (windows).

Link to comment
Share on other sites

  • 3 years later...

Late to reply to this but thought it may serve as useful for anyone hitting on this as I did from Google.

 

A quick and easy way to force the browser to allow you to save as a particular filename and/or extension is to pass the filename and extension into the URL (or form action depending on how you are generating the image)

 

eg as a form post

<form name="myform" action="picgenerator.php?name=thepic.jpg" method="post">...

 

or as just a URL (in the querystring)

http://www.mywebsite.com/picgenerator.php?name=thepic.jpg

 

Now, right-clicking on the image and choosing "Save as" (or equivalent, depending on which browser you are using) will save the file as a jpeg defaulting to the name thepic.jpg

 

Works for all browsers (as far as I know)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.