how to get SWF file dimensions in PHP? - php

how to get SWF file dimensions in PHP?

getimagesize I believe accounts for swfs: http://us.php.net/getimagesize

You could install and run the swfdump utility.
I've also read that PHP's getimagesize() has some limited support for SWF files.

Related

How do you get image from this kind off links using php?

I am trying to receive and use an api from another site using php. How would I get the link?
https://assetgame.roblox.com/Asset/?id=942531508
this links downloads a file auto, but how would I save it using php (to a path on my site)?
And changing the file extention to .PNG?
file_put_contents("gh", "https://assetgame.roblox.com/Asset/?id=942531508");
you want to brother with gd library for converting if this is not a png

How to detect the compression level of a JPEG image?

Would it be possible to detect the compression level of a JPEG image using PHP, without having the "original" (uncompressed) version of the file?
If yes, how to do it?
Yes PHP Imagick can do this for you.
http://www.php.net/manual/en/imagick.getcompression.php
http://www.php.net/manual/en/imagick.getcompressionquality.php

how to convert PHP GD generated images into PDF

our website has a certification image created by PHP GD, and I can print and watch it on a web page. But I couldn't make it a downloadable PDF file. Is there a way I can do that?
You can first save the image somewhere and then use the FPDF lib to write it in a PDF file
you could use imagick to do this..
the below command does the trick if your server is properly configured - Imagick is installed, GhostScript is installed, php is allowed to execute shell commands, etc
shell_exec('convert /path/to/input.png /path/to/output.pdf')

getimagesize function does not working

Images in my website is located in other server. I tried to get the size of an image using getimagesize of php and it is not working. It gives an error 'getimagesize is not seekable'. I tried this same function from other server(images are in same server and I change the location of the file, which is using getimagesize function) and it worked. Can anyone solve this?
From the manual:
filename
This parameter specifies the file you wish to retrieve information about. It can reference a local file or (configuration permitting) a remote file using one of the supported streams.
The settings they're talking about (for the HTTP wrappers) is for the most part having allow_url_fopen enabled or disabled.
The error is probably could not make seekable and could mean that PHP / GD cannot recognize the image file as such.
Have you tried with different images and different image formats (GIF, JPG, PNG) ?
Maybe GIF or PNG is not supported by your PHP version.
maybe the image path is wrong
try using this instead:
dirname($_SERVER['SCRIPT_FILENAME'])
it will return the parent directory's path,
example:
getimagesize(dirname($_SERVER['SCRIPT_FILENAME']).'/images/sampleimage.jpg');

PHP's imagejpeg function isn't outputting an image

I'm using PHPs imagecreatefromjpeg to load a jpeg from disk and imagejpeg to output that image to the browser. For some reason though, this function is only outputting the image when the server is running on a Windows development box. On our Linux server, its not outputting any data (ie. Content-Length: 0, nothing is displayed).
Are there any workarounds that make this work on a Linux box? I've confirmed that the GD library is installed with jpeg support.
There are two notes on http://php.net/imagejpeg which may be relevant:
Notes
Note: JPEG support is only available
if PHP was compiled against GD-1.8 or
later.
Note: If you want to output
Progressive JPEGs, you need to set
interlacing on with imageinterlace().
Also some actual code would be useful in attempting to help.
Make sure you have the correct file permissions set. Does your web service own the file? Does it have permission to read or write the file?

Categories