Dragen Posted November 19, 2010 Share Posted November 19, 2010 Hi, It's been a while since I've been on here... I've got a script that takes an image url and resizes it, then outputs it to the screen (using image headers etc). I've then got a htaccess file that changes my nice url, such as: 'images/thumb/50-70/logo.jpg' to: 'incudes/resize.php?width=50&height=70&img=logo.jpg' Which is the resize script, so I can use a nice url in img tags. The width and height are just the maximum allowed, so sometime the image will be smaller. Now, this all works correctly, but I am now trying to find out the width and height of the thumbnailed image, from outside of the resize.php script. I thought that I could use getimagesize, but this doesn't seem to work... I first tried it using the 'nice' url: '/images/thumb/50-70/logo.jpg' Thinking that .htaccess would re-direct, but no. I then tried a direct link to the resize file: '/incudes/resize.php?width=50&height=70&img=logo.jpg' But that returns a file not found error... Although I can access the file directly. Trying the direct url without the get variables, however, successfully finds the file, but it doesn't seem to be able to detect the image dimensions. I just get a blank result.. Is PHP able to recognise htaccess re-directs? Is PHP able to parse a php file that outputs as an image? (I have all the correct headers etc set!) Thanks Quote Link to comment Share on other sites More sharing options...
Dragen Posted November 19, 2010 Author Share Posted November 19, 2010 Okay, an update. After finding this forum topic on stack overflow: http://stackoverflow.com/questions/2430478/php-problem-with-getimagesize I tried using the full url: http://www.mydomain.com/incudes/resize.php?width=50&height=70&img=logo.jpg And it works. I'm not sure quite why this makes a difference, but is there any way around it? I quite need to be able to use relative paths. Regards. Quote Link to comment Share on other sites More sharing options...
trochia Posted November 19, 2010 Share Posted November 19, 2010 Howdy Dragen, It's been a while since I've been on here...[/quuote] Same foe me, and I subscribed to this....when it popped up... It's been a few years size I played w/getImgSize..., but here's my "train of thought"...and I think it's up your alley... Sounds like a function you'll need to whip out to: tempStore (cache in memory) reNameUrl basedOnSyntax Sorry? But my head is into something else I need to finish....but without knowing just what/where the images go? I think you get te idea....so...if "multiple places for names (and or storage)...is what is my unkown. Jim Quote Link to comment Share on other sites More sharing options...
Dragen Posted November 20, 2010 Author Share Posted November 20, 2010 Sorry, but your response didn't make much sense... What do you mean by: tempStore (cache in memory) reNameUrl basedOnSyntax Also, the images are just stored in a folder in the root directory. The script just reads the images, scales them down and outputs them in the page. It doesn't save the thumbnailed image anywhere. Thanks. Quote Link to comment Share on other sites More sharing options...
Dragen Posted November 21, 2010 Author Share Posted November 21, 2010 Does anyone have an answer for this? I need to be able to use getimagesize on he php script that outputs the image, without having to use a direct url. Thanks. Quote Link to comment 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.