For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > May 2004 > imageJPEG()









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author imageJPEG()
enc

2004-05-30, 8:31 pm

Hi,

I am using the imageJPEG() function to save an image after I have edited it.
The image is being saved in the same directory as the script. Does anyone
know how to change the directory the image is saved in?

Thanks.

John

ps here is the function I am using
****************************************
**********

function save($save="")
{
//save thumb
if (empty($save))
$save=strtolower("./thumb.".$this->img["format"]);


/* change ImageCreateTrueColor to ImageCreate if your GD not supported
ImageCreateTrueColor function*/
$this->img["des"] =
ImageCreateTrueColor($this->img["lebar_thumb"],$this->img["tinggi_thumb"]);
@imagecopyresized ($this->img["des"], $this->img["src"], 0, 0, 0, 0,
$this->img["lebar_thumb"], $this->img["tinggi_thumb"], $this->img["lebar"],
$this->img["tinggi"]);

if ($this->img["format"]=="JPG" || $this->img["format"]=="JPEG") {
//JPEG
imageJPEG($this->img["des"],"$save",$this->img["quality"]);
} elseif ($this->img["format"]=="PNG") {
//PNG
imagePNG($this->img["des"],"$save");
} elseif ($this->img["format"]=="GIF") {
//GIF
imageGIF($this->img["des"],"$save");
} elseif ($this->img["format"]=="WBMP") {
//WBMP
imageWBMP($this->img["des"],"$save");
}
}


Alvaro G Vicario

2004-05-31, 12:31 pm

*** enc wrote/escribió (Mon, 31 May 2004 01:29:14 +0200):
> I am using the imageJPEG() function to save an image after I have edited it.
> The image is being saved in the same directory as the script. Does anyone
> know how to change the directory the image is saved in?


> function save($save="")


Have you tried changing the save parameter?


> {
> //save thumb
> if (empty($save))
> $save=strtolower("./thumb.".$this->img["format"]);



--
--
-- Álvaro G. Vicario - Burgos, Spain
--
enc

2004-05-31, 6:31 pm


"Alvaro G Vicario" <alvaro_QUITAR_REMOVE@telecomputeronline.com> wrote in
message news:rc3m0tpzv8gl$.qgg2ehius8n6$.dlg@40tude.net...
> *** enc wrote/escribió (Mon, 31 May 2004 01:29:14 +0200):
it.[color=darkred]
anyone[color=darkred]
>
>
> Have you tried changing the save parameter?
>

Thanks. I didn't realise that it would take a path instead of just a file
name,


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com