Reputation: 167
I create one page for image conversion.I want to convert image from .ai to .jpg.But issue is that how can i get dimensions(width and height) of AI file.I alredy tried getimagesize() but it's not working, it give me blank response.
Here is my php code
if($fileType == 'psd' || $fileType == 'ai' || $fileType == 'eps' || $fileType == 'pdf'){
$source_file_name = get_file_name(basename($_FILES["sfile"]["name"]));
if (move_uploaded_file($_FILES["sfile"]["tmp_name"],SOURCE_UPLOAD_PATH.$source_file_name)) {
//get dimensions of image
$dimensions = getimagesize(SOURCE_UPLOAD_PATH.$source_file_name);
echo "<pre>";
print_r($dimensions);exit;
Upvotes: 1
Views: 363
Reputation: 2973
You can use Imagick
<?php
$image = new Imagick();
$image->readimage($imagePath);
if ($fileType == "psd" || $fileType == "ai"){
$image->setIteratorIndex(0);
}
$dimensions = $image->getImageGeometry();
$width = $dimensions['width'];
$height = $dimensions['height'];
echo "Your image is $width by $height pixels";
Upvotes: 1