Jump to content


thumbnail help


6 replies to this topic

#1 BlazeForc3

    Young Padawan

  • Members
  • Pip
  • 62 posts
  • Location:Australia

Posted 13 August 2006 - 08:55 PM

Ive made a php image thumbnailer and i want to output the thumb in a webpage without having to save it to a file on my server, im trying to do it with imagejpeg($file); but since it is within a html document the headers arnt right and it just outputs a bunch of random characters?

#2 Demonslay

    P2L Jedi

  • Members
  • PipPipPip
  • 970 posts
  • Gender:Male
  • Location:A strange world where water falls out of the sky... for no reason.
  • Interests:Graphic Design, Coding, Splinter Cell, Cats

Posted 13 August 2006 - 10:42 PM

Well, you have two options with this.
Either you make a function (which I wouldn't recommend personally), or you can make a file which can easily be used with anything.
It's not just 'random characters' by the way, lol, those are the bits that describe the image to a program. ;) (I know you know that, lol.)

Anyways, ya, you can't have it like that anyways, you would actually have to have it a seperate file now that I think of it...
Then you would call an image simply like this.
<img src="/thumbnail.php?src=images/file.jpg" />

If you need help, feel free to contact me over MSN or something. I just finished editing a thumbnailer this afternoon and adding my own little features lol. :)

#3 NGPixel

    Senior Programmer

  • P2L Staff
  • PipPipPipPip
  • 1,410 posts
  • Gender:Male
  • Location:Montreal, Canada
  • Interests:Web Design : Coding : Animation

Posted 13 August 2006 - 10:46 PM

Be sure to send the headers as an image type or you will see weird characters. You need to send them before making the image output.

#4 BlazeForc3

    Young Padawan

  • Members
  • Pip
  • 62 posts
  • Location:Australia

Posted 14 August 2006 - 02:31 AM

View PostDemonslay, on Aug 14 2006, 03:42 AM, said:

Well, you have two options with this.
Either you make a function (which I wouldn't recommend personally), or you can make a file which can easily be used with anything.
It's not just 'random characters' by the way, lol, those are the bits that describe the image to a program. :o (I know you know that, lol.)

Anyways, ya, you can't have it like that anyways, you would actually have to have it a seperate file now that I think of it...
Then you would call an image simply like this.
<img src="/thumbnail.php?src=images/file.jpg" />

If you need help, feel free to contact me over MSN or something. I just finished editing a thumbnailer this afternoon and adding my own little features lol. :)

if thats the case then how can i execute a function when the user navigates away from the page or closes the browser window?

#5 Wybe

    Jedi In Training

  • Members
  • PipPip
  • 399 posts
  • Gender:Male
  • Location:the Netherlands
  • Interests:Graphic design, digital and traditional, street style, graffiti, guerilla drawing, typography, coding, sex

Posted 14 August 2006 - 04:00 AM

IF you want to trigger a function when the user leaves the page (that's what I understand you want) you should do it with javascript on that page somehow, but you can't trigger PHP functions with that, or you do it on a new page.

What kind of function, for starters?

#6 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 15 August 2006 - 01:51 AM

View PostBlazeForc3, on Aug 14 2006, 01:30 AM, said:

if thats the case then how can i execute a function when the user navigates away from the page or closes the browser window?
You actually want to ignore the first part of his post, and pay closer attention to the 2nd part. The only way to create a thumbnail on a page is to use the <img> tag (basic html). Just have it point to a file containing the thumbnail script, pass a variable with the path to the original image in the query string, and have it create the image that way.

#7 BlazeForc3

    Young Padawan

  • Members
  • Pip
  • 62 posts
  • Location:Australia

Posted 18 August 2006 - 08:35 AM

View Postrc69, on Aug 15 2006, 06:50 AM, said:

View PostBlazeForc3, on Aug 14 2006, 01:30 AM, said:

if thats the case then how can i execute a function when the user navigates away from the page or closes the browser window?
You actually want to ignore the first part of his post, and pay closer attention to the 2nd part. The only way to create a thumbnail on a page is to use the <img> tag (basic html). Just have it point to a file containing the thumbnail script, pass a variable with the path to the original image in the query string, and have it create the image that way.

your a very helpfull person when it comes to php rc69 thanks ^_^





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users