Have you tried adding "application_readable" to
arial.ttf?
https://cloud.google.com/appengine/docs/php/config/appconfig#application_readable
On Monday, November 9, 2015 at 4:09:03 AM UTC-8, Contact PlutonMedia wrote:
>
> Hi,
>
> Is there a trick to be able to load a custom font and use compositeImage?
>
> Here is my code :
>
> app.yaml
>
> application: the_name
> version: 1
> runtime: php55
> api_version: 1
> threadsafe: yes
>
>
> handlers:
> - url: /favicon\.ico
> static_files: favicon.ico
> upload: favicon\.ico
>
>
> - url: /009\.jpg
> static_files: 009.jpg
> upload: 009\.jpg
> application_readable: true
>
>
> - url: /RosewoodStdRegular\.otf
> static_files: RosewoodStdRegular.otf
> upload: RosewoodStdRegular\.otf
> mime_type: application/x-font-otf
>
>
> - url: /arial\.ttf
> static_files: arial.ttf
> upload: arial\.ttf
> mime_type: application/x-font-ttf
>
>
> - url: .*
> script: main.php
>
>
>
> main.php
>
>
>
>
> <?php
> try {
>
>
> $img = new Imagick("009.jpg");
>
> $img->setImageCompressionQuality(100);
>
> //ADD TEXT
> $text = array(
> 'width' => 300,
> 'height'=> 80,
> 'x' => 420,
> 'y' => 160,
> 'font' => 'arial.ttf',
> 'color' => 'black',
> 'value' => "Coucou"
> );
>
> $addText = new Imagick();
> $addText->setBackgroundColor("transparent");
> $addText->setFont($text['font']);
> $addText->newPseudoImage($text['width'],$text['height'], "Caption:".$text
> ['value'] );
> $addText->colorizeImage($text['color'],1);
> $img->compositeImage($addText, Imagick::COMPOSITE_OVER, $text['x'], $text
> ['y']);
>
>
>
> $img->setImageFormat('jpg');
> //header('Content-Type: image/jpg');
> //echo $img;
>
> } catch (Exception $e) {
> echo 'Caught exception: ', $e->getMessage(), "\n";
> }
>
>
>
>
>
>
>
>
>
> But I get
>
> Caught exception: The given font is not found in the ImageMagick
> configuration and the file (app_path/1.388444744529109221/arial.ttf) is
> not accessible
>
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-appengine.
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-appengine/fe09841e-d768-407b-bba3-7af7009eff0c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.