TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 06-04-2008, 07:13 PM   #21 (permalink)
is cute and cuddly
 
delayedinsanity's Avatar
 
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 963
Thanks: 31
delayedinsanity is on a distinguished road
Default

PHP: imagejpeg - Manual

Any of the functions, imagejpeg, imagepng, imagegif et al will output a direct stream if the second argument is null.
-m
delayedinsanity is offline  
Reply With Quote
Old 06-04-2008, 07:21 PM   #22 (permalink)
The Contributor
 
j4v1's Avatar
 
Join Date: May 2008
Posts: 30
Thanks: 5
j4v1 is on a distinguished road
Default

so all i need to do at the end of the script is imagegif()???
j4v1 is offline  
Reply With Quote
Old 06-04-2008, 07:47 PM   #23 (permalink)
is cute and cuddly
 
delayedinsanity's Avatar
 
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 963
Thanks: 31
delayedinsanity is on a distinguished road
Default

imagegif($dimg) (according to your source) will output a direct stream. When you include $filename it copies it to that location. The link in my previous post goes to the manual page that explains it in further detail if you'd like.
-m
delayedinsanity is offline  
Reply With Quote
Old 06-04-2008, 11:25 PM   #24 (permalink)
The Contributor
 
j4v1's Avatar
 
Join Date: May 2008
Posts: 30
Thanks: 5
j4v1 is on a distinguished road
Default

Why is that when I call this script from http://localhost:{port}/test.php it comes up. But when I create an html file, and call the script <img src=test.php/>

It comes back w/ and empty image box??


Quote:
<?php
ob_start();
$filename = "http://images.wsdot.wa.gov/nwflow/flowmaps/sysvert.gif";
$newwidth = (isset($_GET['width'])) ? $_GET['width'] : "538";
$format='image/gif';
if($format!='')
{
list($width, $height) = getimagesize($filename);
$newheight=$height*$newwidth/$width;
switch($format)
{
case 'image/gif';
$source = imagecreatefromgif($filename);
break;
}
$dimg = imagecreatetruecolor(640,538);
imagealphablending($dimg, false);
$source = imagecreatefromgif("$filename");
imagecopyresized($dimg, $source, 0,0,0,438, $newwidth, $newheight, $width, $height);
$filename="$output_dir/test1.gif";
ob_end_clean();
header('Content-Type: image/gif');
imagegif($dimg);
imagedestroy($dimg);
}
?>
j4v1 is offline  
Reply With Quote
Old 06-04-2008, 11:51 PM   #25 (permalink)
is cute and cuddly
 
delayedinsanity's Avatar
 
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 963
Thanks: 31
delayedinsanity is on a distinguished road
Default

Works for me, and I didn't modify it at all, just copy and pasted your code right into a test file.
delayedinsanity is offline  
Reply With Quote
The Following User Says Thank You to delayedinsanity For This Useful Post:
j4v1 (06-05-2008)
Old 06-05-2008, 12:30 AM   #26 (permalink)
The Contributor
 
j4v1's Avatar
 
Join Date: May 2008
Posts: 30
Thanks: 5
j4v1 is on a distinguished road
Default

actually worked for me too....the second time
j4v1 is offline  
Reply With Quote
Old 06-05-2008, 06:55 AM   #27 (permalink)
The Contributor
 
Join Date: May 2008
Location: Denmark
Posts: 70
Thanks: 3
SpYkE112 is on a distinguished road
Default

Now that you know it works then i would recommend you to ident your code, that means:
PHP Code:
<?php
if ($this == true) {
    echo(
'This functions indented!');
} else {
    echo(
'This one to!');
    if (
$that == false) {
        echo(
'Another level of indenting');
    } else {
        echo(
'And another');
    }
}
?>
SpYkE112 is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 11:55 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design