Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…-jpg into maestro
  • Loading branch information
jdevinemt committed Mar 22, 2024
2 parents 095898c + 1536658 commit e60d70b
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 31 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,8 @@ Added pest test and workflows for linux, windows and macos. Run tests locally wi
##### To Do

- Find out if it can be used with docker CLI command from PHP, add in docs if yes
- Try to update to Go 1.21 version
- Add github action for generating executables
- Add issue #33 and solution as arm64 example
- Add changes from issue #28 (try/catch)
- Add alternative packages in Docs from this issue [comment](https://github.com/MaestroError/php-heic-to-jpg/issues/25#issuecomment-1903901459)
62 changes: 31 additions & 31 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
{
"name": "maestroerror/php-heic-to-jpg",
"description": "Converts HEIC/HEIF image to JPG type, without any dependencies",
"license": "MIT",
"autoload": {
"psr-4": {
"Maestroerror\\": "src/"
}
},
"authors": [
{
"name": "maestroerror",
"email": "revaz.gh@gmail.com"
}
],
"minimum-stability": "dev",
"bin": [
"bin/heicToJpg",
"bin/heicToJpgWin"
],
"require-dev": {
"pestphp/pest": "2.x-dev"
},
"config": {
"allow-plugins": {
"pestphp/pest-plugin": true
}
},
"require": {
"php": ">=7.4",
"maestroerror/heif-converter": "0.2"
"name": "maestroerror/php-heic-to-jpg",
"description": "Converts HEIC/HEIF image to JPG type, without any dependencies",
"license": "MIT",
"autoload": {
"psr-4": {
"Maestroerror\\": "src/"
}
}
},
"authors": [
{
"name": "maestroerror",
"email": "revaz.gh@gmail.com"
}
],
"minimum-stability": "dev",
"bin": [
"bin/heicToJpg",
"bin/heicToJpgWin"
],
"require-dev": {
"pestphp/pest": "2.x-dev"
},
"config": {
"allow-plugins": {
"pestphp/pest-plugin": true
}
},
"require": {
"maestroerror/heif-converter": "0.2",
"php": ">=7.4"
}
}
25 changes: 25 additions & 0 deletions test-binary-issue-36.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

include "src/HeicToJpg.php";

$path = "test-binary-bad.heic";
$dest = "test-binary-bad.jpg";

if(Maestroerror\HeicToJpg::isHeic($path)) {
// 1. save as file
try{
$result = \Maestroerror\HeicToJpg::convert($path)->saveAs($dest);
}catch (\Exception $e) {
return explode(':', $e->getMessage())[0];
}

// Works
$jpg = file_get_contents($dest);
$base64=base64_encode($jpg);
echo "<img src='data:image/jpeg;base64, $base64'/>";

// Works
$jpg = \Maestroerror\HeicToJpg::convert($path)->get();
$base64=base64_encode($jpg);
echo "<img src='data:image/jpeg;base64, $base64'/>";
}

0 comments on commit e60d70b

Please sign in to comment.