Jump to content

getimagesize() on php file outputting a image


Dragen

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.