Image copying

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I'm having a real frustrating time with my problem here, which is to copy one JPEG to another resource. I'm not even sure where I'm going wrong, or how to find it out, because it seems that I'm getting all my resource IDs fine (when I echo them, I get 'resource ID #x'), and no error message pops up. Just a broken image is produced. I've been racking myself for so long now that my problem may be right under my nose, but my brain is so baked it's just not working. And I've tried to leave and come back to it, but... you know how it is. Here's what I'm doing.

What I'm trying to do is copy one JPEG to another JPEG (as mentioned) on the fly. I don't want to have a new file produced, just a modified JPEG (a few circles here and there) held in a resource. Here's how I call my function and how I display the image via HTML:

print("<IMG ALT... HEIGHT... WIDTH... SRC = \"" . copy_pic($sourcepic) . "\">");

So I'm calling the function straight from the SRC attribute of the IMG tag. Here's what's in my function:

function copy_pic($sourcepic) {
   if(file_exists($sourcepic)) {
      $destinationpic = imagecreatetruecolor(imagesx($sourcepic), imagesy($sourcepic));
      imagecopy($destinationpic, $sourcepic, 0, 0, 0, 0, imagesx($sourcepic), imagesy($sourcepic));
   }

   return $destinationpic;
}

After this, I'm going to be tampering with the pic, but I just wanted to make sure I'm getting something, which I'm not. All I get is a broken image. No error message, no nothing. Please tell me I'm not overlooking some really idiotic thing, but I'm just having one heckuva time with this.

Thanks, everyone.

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux