mcpalmer Posted March 27, 2006 Share Posted March 27, 2006 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 Quote Link to comment https://forums.phpfreaks.com/topic/5949-image-resize-script-was-working-not-working-anymore/ Share on other sites More sharing options...
kenrbnsn Posted March 27, 2006 Share Posted March 27, 2006 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 Quote Link to comment https://forums.phpfreaks.com/topic/5949-image-resize-script-was-working-not-working-anymore/#findComment-21317 Share on other sites More sharing options...
mcpalmer Posted March 27, 2006 Author Share Posted March 27, 2006 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! Quote Link to comment https://forums.phpfreaks.com/topic/5949-image-resize-script-was-working-not-working-anymore/#findComment-21375 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.