Jump to content

Alternate function selection.. Does my choice is good?


karthikeyan_coder

Recommended Posts

hi,
  My server admin blocked remote file include in my server due to security problems. so i cannt execute getimagesize(); function.. i use this function to get width,height and type...

So i decided to use three separate functions for those pupose

1. imagex();
2. imagey();
3. exif_imagetype();

$filename is having some url.. like http://www.phpfreaks.com/images/logo_main.jpg

        $width = imagesx($filename);
$height = imagesy($filename);
$type = exif_imagetype($filename);

Error:
[b]Warning: imagesx(): [/b]supplied argument is not a valid Image resource in morph.php on line 474

[b]Warning: imagesy():[/b] supplied argument is not a valid Image resource in photo-morph.php on line 475

[b]Fatal error: Call to undefined function:[/b] exif_imagetype() in photo-morph.php on line 476

Please help me.
The first two are failing because they take an image "resource" (basically a pointer or object) not the image path.

Try this
[code]<?php
$img = @imagecreatefromjpeg("http://www.mysite.com/my_image.jpg");
$width = imagesx($img);
$height = imagesy($img);
?>[/code]

I don't know why exif_imagetype is failing. What version of PHP are you using?

Archived

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

×
×
  • 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.