Jump to content

Archived

This topic is now archived and is closed to further replies.

mcpalmer

image resize script was working - not working anymore!

Recommended Posts

Hi,

I'm using a simple image resize php script to resize images. It was working fine but has now stopped working but can't figure out why! The script is:

[code]$src = imagecreatefromjpeg($image);
    $width = imagesx($src);
    $height = imagesy($src);
    $x = $w; $y = $h;
    $dst = imagecreatetruecolor($x,$y);
    imagecopyresampled($dst,$src,0,0,0,0,$x,$y,$width,$height);    
    header('Content-Type: image/png');
    imagepng($dst);[/code]

Its saved as scale_img.php and called from another page like so:

[code]<img src="scale_img.php?image=images/horses.jpg&w=100&h=100" />[/code]

Is there anything wrong with the php code? It looks ok to me. Could changed php settings on the server ( i use third party) affect it working or not? Other php/mysql scripts work fine

Share this post


Link to post
Share on other sites
What do mean by "not working"?

Looking at your code, it looks like you're assuming that register_globals is enabled. If your host set it to disabled, that would explain the problem.

If this is the problem -- comfirm it with your host, then the fix is simple, just change "$image" to $_GET['image']
[code]<?php
$src = imagecreatefromjpeg($_GET['image']);
?>[/code]

If you host changed register_globals from enabled to disabled without telling you, then if I were you, I would complain loudly.

Ken

Share this post


Link to post
Share on other sites
I tried other gd functions and they didn't work either so it appears the host has messed up big time! It appears a security update screwed things up - great! The webspace is really cheap but i didn't expect this to happen!

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.