Image Script Problems

GD and GD2 are useful libraries for creating graphics on-the-fly. Discuss your PHP GD and GD2 scripts here.

Moderators: onion2k, General Moderators

Post Reply
keymaker
Forum Newbie
Posts: 3
Joined: Tue Oct 17, 2006 4:38 pm

Image Script Problems

Post by keymaker »

Jcart | Split from viewtopic.php?t=50500&highlight=

I purchased this script, and it seems to do everything they claim except I cant get it to output directly to the browser. Doesnt seem to recognise thats its an image?

I have sent 2 emails over the last 2 days that read.
Hi

PHP Version 4.4.2
GD Version bundled (2.0.28 compatible)

I am using DotScriptTM PHP Image Sorcerer.

I am having trouble outputting the browser. I can output a manipulated image to a file succesfully.

But when I out put the same image to the browser I get text that starts like

ÿØÿàJFIFÿþ;CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), quality = 75 ÿÛC $.' ",#(7),01444'9=82<.342ÿÛC 2!!

Are you able to tell me what Im doing wrong?

Thanks in advance
so far I have had no reply

may someone else using this script has some idea?

If it works for you its a probably a timesaver and worth $5 but If your a novice like me I wouldnt count on their 24/7 support :(
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

Sounds like you arn't outputting the correct headers. How are you trying to output the image?

Some code would help.
keymaker
Forum Newbie
Posts: 3
Joined: Tue Oct 17, 2006 4:38 pm

24/7 support ???

Post by keymaker »

:oops: Blagovest one of the authors replyed to my email as I was writing the above post also asking for more info.

Using one of the examples off their site

Code: Select all

<html>
<head>
</head>

<body>

<?php

require 'sorcerer.class.php';
$img = new sorcerer; // instantiate the class
$result = $img->setfile('img/apples_three.jpg'); // set the target file

if ($result != IR_E_OK) // check for errors
    die($img->last_error()); // if there are any errors, an appropriate message is displayed

$img->resize_fit_region(150, 150); // resize to best fit a region of 150x150
$result = $img->fill_buffer($img->get_image_type(), true); // render the resulting image

if ($result != IR_E_OK)
    die($img->last_error());

$result = $img->flush_buffer(true, 'mycachedir/image_resized.jpg'); // write the image to the desired file

if ($result != IR_E_OK)
    die($img->last_error());
else
    echo "File written successfully.";

?> 
</body>
</html>
keymaker
Forum Newbie
Posts: 3
Joined: Tue Oct 17, 2006 4:38 pm

Post by keymaker »

Blagovest has shown me what I was doing wrong.
The problem is that you try to output the image directly in the html page, which is incorrect. The php code should be in a different file, say "image.php" and then you will have an <img src="image.php"> in the html page.
So I must say, Well worth $5

There was no way a novice like me was going to get the results Im now getting without this kind of script.

Thanks all
Post Reply