Exemplo n.º 1
0
        echo $key;
        ?>
" style=" height: 100%;">
                                                                                    <svg  height="100%" viewBox="0 0 700 250">
                                                                                        <?php 
        if (!empty($page['svg'])) {
            echo $page['svg'];
        }
        ?>
                                                                                    </svg>

                                                                                </div>
                                                                            </div>
                                                                            <div class="" style="position: absolute; left:50%; width: 50%; height: 100%; background-color: #ffffff; opacity: 0.9;  filter: alpha(Opacity=70); "></div>
                                                                            <div class="tracing-text-background" style="position: absolute; left:50%; width: 50%; height: 100%; background-size: contain; background-image: url('<?php 
        echo UserUrl::photobookTracingText(true, $model->id, $model->user_id) . "/" . UserUrl::imageFile($model->id, UserUrl::IMAGE_ORIGINAL, 'png');
        ?>
');    "></div>
                                                                        </div>
                                                                    </div>
                                                                </div>
                                                            </div>

                                                            <div class="bb-item" id="vitem2" >
                                                                <div class="content" >
                                                                    <div class="box" >
                                                                        <div style="width: 100%; height: 100%; position: absolute;   ">
                                                                            <div style="width: 100%; height: 100%; position: absolute;   background-size: cover; background-image: url('<?php 
        echo UserUrl::stylePaddedPassepartout(true, $style->id) . DIRECTORY_SEPARATOR . UserUrl::imageFile($style->padded_passepartout_key, UserUrl::IMAGE_ORIGINAL);
        ?>
');">
Exemplo n.º 2
0
 public function updateCoverWindowImageText($field_name, $value)
 {
     $this->{$field_name} = $value;
     /*if(!$this->save()){
     
                 return ['error'=>['msg'=>Yii::t('app', 'Ошибка записи в базу-данных')]];
             }*/
     //$this->loadById($this->id);
     $style = Style::findOne(['id' => $this->style_id]);
     if (empty($style)) {
         return ['error' => ['msg' => Yii::t('app', 'Стиль для фотокниги не найден')]];
     }
     $font = Font::findOne(['id' => $style->font_id]);
     if (empty($font)) {
         return ['error' => ['msg' => Yii::t('app', 'Шрифт для фотокниги не найден')]];
     }
     $cover = Cover::findOne(['id' => $this->cover_id]);
     if (empty($cover)) {
         return ['error' => ['msg' => Yii::t('app', 'Обложка для фотокниги не найден')]];
     }
     $font_path = UserUrl::font(false) . DIRECTORY_SEPARATOR . UserUrl::fontFile($font->file);
     $line_1 = !empty($this->title_line_1) ? $this->title_line_1 : ' ';
     $line_2 = !empty($this->title_line_2) ? $this->title_line_2 : ' ';
     $line_3 = !empty($this->title_line_3) ? $this->title_line_3 : ' ';
     $line_4 = !empty($this->title_line_3) ? $this->title_line_4 : ' ';
     $this->name = $line_1 . " " . $line_2 . " " . $line_3;
     $this->save();
     $text = $line_1 . "\n" . $line_2 . "\n" . $line_3;
     $text_image_content = Utils::makeTextImage($text, $cover->window_width, $cover->window_height, '#000000', $font_path, 2, 72);
     $text_image_path = UserUrl::photobookWindowText(false, $this->id, $this->user_id) . DIRECTORY_SEPARATOR . UserUrl::imageFile($this->id, UserUrl::IMAGE_ORIGINAL, 'png');
     $text_image_url = UserUrl::photobookWindowText(true, $this->id, $this->user_id) . "/" . UserUrl::imageFile($this->id, UserUrl::IMAGE_ORIGINAL, 'png');
     $user_pb_path = UserUrl::photobook(false, $this->id, $this->user_id);
     if (file_exists($user_pb_path)) {
         Yii::getLogger()->log('updateCoverWindowImageText exists user_pb_path:' . $user_pb_path, YII_DEBUG);
     } else {
         Yii::getLogger()->log('updateCoverWindowImageText NOT exists user_pb_path:' . $user_pb_path, YII_DEBUG);
     }
     // UserUrl::createNonexistentDirInPath(UserUrl::photobookWindowText(, 'pb'.DIRECTORY_SEPARATOR.$photobook_id)
     file_put_contents($text_image_path, $text_image_content);
     $file_tmp = new UploadedFile();
     $file_tmp->tempName = $text_image_path;
     $name = AlphaId::id($this->user_id) . '/pb/' . AlphaId::id($this->id) . '/window_text/' . UserUrl::imageFile($this->id, UserUrl::IMAGE_ORIGINAL, 'png');
     Yii::$app->resourceManager->save($file_tmp, $name);
     unlink($text_image_path);
     $tracing_text = $line_1 . "\n" . $line_2 . "\n" . $line_3 . "\n" . " " . "\n" . " " . "\n" . " " . "\n" . " " . "\n" . " " . $line_4;
     $tracing_text_image_content = Utils::makeTextImage($tracing_text, 350, 250, '#000000', $font_path, 15, 72);
     $tracing_text_image_path = UserUrl::photobookTracingText(false, $this->id, $this->user_id) . DIRECTORY_SEPARATOR . UserUrl::imageFile($this->id, UserUrl::IMAGE_ORIGINAL, 'png');
     $tracing_text_image_url = UserUrl::photobookTracingText(true, $this->id, $this->user_id) . DIRECTORY_SEPARATOR . UserUrl::imageFile($this->id, UserUrl::IMAGE_ORIGINAL, 'png');
     file_put_contents($tracing_text_image_path, $tracing_text_image_content);
     $file_tmp = new UploadedFile();
     $file_tmp->tempName = $tracing_text_image_path;
     $name = AlphaId::id($this->user_id) . '/pb/' . AlphaId::id($this->id) . '/tracing/' . UserUrl::imageFile($this->id, UserUrl::IMAGE_ORIGINAL, 'png');
     Yii::$app->resourceManager->save($file_tmp, $name);
     unlink($tracing_text_image_path);
     return ['response' => ['status' => true, 'value' => $value, 'text_image_url' => $text_image_url, 'tracing_text_image_url' => $tracing_text_image_url, 'window_offset_x' => $cover->window_offset_x, 'window_offset_y' => $cover->window_offset_y, 'window_width' => $cover->window_width, 'window_height' => $cover->window_height, 'font_path' => $font_path, 'text' => $text, 'name' => $this->name]];
 }