function ptgen_generator($post_id)
{
$pg_options = get_option('pg_options');
$text = pg_limit_text(get_the_title($post_id), 30);
$call_to_action_text = $pg_options['pg_text_call_to_action'];
$call_to_action_website = $pg_options['pg_website_call_to_action'];
$thumbnail = get_the_post_thumbnail_url($post_id, 'full');
$hash = hash('md5', strval($post_id));
$photo_diretory = PTGEN_PLUGIN_PATH . 'files/images/img-' . $hash . '.jpg';
// Fix: Encode the URL properly to handle special characters
$encoded_thumbnail = esc_url_raw($thumbnail);
// Use wp_safe_remote_get instead of file_get_contents for better error handling
$response = wp_safe_remote_get($encoded_thumbnail, array(
'timeout' => 60,
'redirection' => 5,
'httpversion' => '1.0',
'-agent' => 'WordPress/' . get_bfo('version'),
'ssl' => false,
));
// Check if the request was successful
if (is_wp_error($response) || 200 !== wp_remote_retrieve_response_code($response)) {
error_log('Failed to image: ' . $encoded_thumbnail);
return false;
}
// Get the image content
$image_content = wp_remote_retrieve_body($response);
// Save the image to the local file
if (file_put_contents($photo_diretory, $image_content)) {
$feed_diretory = PTGEN_PLUGIN_PATH . 'files/feed-' . $hash . '.jpg';
$feed_facebook_diretory = PTGEN_PLUGIN_PATH . 'files/feed-facebook-' . $hash . '.jpg';
$story_diretory = PTGEN_PLUGIN_PATH . 'files/story-' . $hash . '.jpg';
$logo = new Imagick();
$logo->readImage(pg_get_image_logo_patch(wp_get_attachment_url($pg_options['pg_image'], 'full')));
$logo->scaleImage(200, 60, true);
// Rest of the function remains the same
// ------------------ FEED FACEBOOK ------------------
$image_fb = new Imagick();
$title_fb = new ImagickDraw();
$cta_fb = new ImagickDraw();
$website_fb = new ImagickDraw();
$pixel_fb = new ImagickPixel('white');
$image_fb->newImage(1440, 1800, $pixel_fb);
$thumbnail_fb = new Imagick($photo_diretory);
$thumbnail_fb->scaleImage(4320, 1800, true);
$thumb_width = $thumbnail_fb->getImageWidth();
$thumb_x = (1440 - $thumb_width) / 2;
$bg_feed_fb = new Imagick();
$bg_feed_fb->readImage(PTGEN_PLUGIN_PATH . "assets/images/feed.png");
$logo_x = 720 - ($logo->getImageWidth() / 2);
$image_fb->compositeImage($thumbnail_fb, Imagick::COMPOSITE_OVER, ceil($thumb_x), 0);
$image_fb->compositeImage($bg_feed_fb, Imagick::COMPOSITE_OVER, 0, 0);
$image_fb->compositeImage($logo, Imagick::COMPOSITE_OVER, ceil($logo_x), 1680);
$title_fb->setFillColor($pg_options['pg_feed_font_color']);
$title_fb->setFont(PTGEN_PLUGIN_PATH . 'assets/fonts/Inter-Bold.ttf');
$title_fb->setFontSize(90);
$title_fb->setTextAlignment(Imagick::ALIGN_CENTER);
list($lines, $lineHeight) = ptgen_word_wrap($image_fb, $title_fb, $text, 1350);
$text_height = count($lines) * $lineHeight;
$title_y = 1350 - ($text_height / 2); // centralizado na área útil inferior
foreach ($lines as $i => $line) {
$image_fb->annotateImage($title_fb, 720, $title_y + $i * $lineHeight, 0, $line);
}
$cta_fb->setFillColor($pg_options['pg_color_call_to_action']);
$cta_fb->setFont(PTGEN_PLUGIN_PATH . 'assets/fonts/Inter-Bold.ttf');
$cta_fb->setFontSize(40);
$cta_fb->setTextAlignment(Imagick::ALIGN_CENTER);
list($lines, $lineHeight) = ptgen_word_wrap($image_fb, $cta_fb, $call_to_action_text, 1300);
foreach ($lines as $i => $line) {
$image_fb->annotateImage($cta_fb, 720, 1200 + $i * $lineHeight, 0, $line);
}
$website_fb->setFillColor($pg_options['pg_color_call_to_action']);
$website_fb->setFont(PTGEN_PLUGIN_PATH . 'assets/fonts/Inter-Bold.ttf');
$website_fb->setFontSize(36);
$website_fb->setTextAlignment(Imagick::ALIGN_CENTER);
list($lines, $lineHeight) = ptgen_word_wrap($image_fb, $website_fb, $call_to_action_website, 1300);
foreach ($lines as $i => $line) {
$image_fb->annotateImage($website_fb, 720, 1200 + $i * $lineHeight, 0, $line);
}
$image_fb->optimizeImageLayers();
$image_fb->setCompression(Imagick::COMPRESSION_JPEG);
$image_fb->setImageFormat("jpg");
$image_fb->setInterlaceScheme(Imagick::INTERLACE_PLANE);
$image_fb->stripImage();
$image_fb->setImageCompressionQuality(0);
$image_fb->writeImage($feed_facebook_diretory);
$image_fb->destroy();
/* ------------------
/ Feed
/ ---------------- */
$image = new Imagick();
$title = new ImagickDraw();
$call_to_action = new ImagickDraw();
$website = new ImagickDraw();
$pixel = new ImagickPixel('white');
$image->newImage(1080, 1080, $pixel);
$thumbnail = new Imagick($photo_diretory);
$thumbnail->scaleImage(3000, 1080, true);
$thumbnail_width = $thumbnail->getImageWidth();
$thumb_position_x = (1080 - $thumbnail_width) / 2;
$bg_feed = new Imagick();
$bg_feed->readImage(PTGEN_PLUGIN_PATH . "assets/images/feed.png");
$logo_position_x = 540 - ($logo->getImageWidth() / 2);
$image->compositeImage($thumbnail, imagick::COMPOSITE_OVER, ceil($thumb_position_x), 0);
$image->compositeImage($bg_feed, imagick::COMPOSITE_OVER, 0, 0);
$image->compositeImage($logo, imagick::COMPOSITE_OVER, ceil($logo_position_x), 980);
$title->setFillColor($pg_options['pg_feed_font_color']);
$title->setFont(PTGEN_PLUGIN_PATH . 'assets/fonts/Inter-Bold.ttf');
$title->setFontSize($pg_options['pg_feed_font_size']);
$title->setTextAlignment(\Imagick::ALIGN_CENTER);
list($lines, $lineHeight) = ptgen_word_wrap($image, $title, $text, 950);
$text_height = sizeof($lines) * $lineHeight;
$title_position_y = 1080 - (180 + $text_height);
for ($i = 0; $i < count($lines); $i++) {
$image->annotateImage($title, 530, $title_position_y + $i * $lineHeight, 0, $lines[$i]);
}
$call_to_action->setFillColor($pg_options['pg_color_call_to_action']);
$call_to_action->setFont(PTGEN_PLUGIN_PATH . 'assets/fonts/Inter-Bold.ttf');
$call_to_action->setFontSize(32);
$call_to_action->setTextAlignment(\Imagick::ALIGN_CENTER);
list($lines, $lineHeight) = ptgen_word_wrap($image, $call_to_action, $call_to_action_text, 950);
for ($i = 0; $i < count($lines); $i++) {
$image->annotateImage($call_to_action, 530, 920 + $i * $lineHeight, 0, $lines[$i]);
}
$website->setFillColor($pg_options['pg_color_call_to_action']);
$website->setFont(PTGEN_PLUGIN_PATH . 'assets/fonts/Inter-Bold.ttf');
$website->setFontSize(32);
$website->setTextAlignment(\Imagick::ALIGN_CENTER);
list($lines, $lineHeight) = ptgen_word_wrap($image, $website, $call_to_action_website, 950);
for ($i = 0; $i < count($lines); $i++) {
$image->annotateImage($website, 530, 965 + $i * $lineHeight, 0, $lines[$i]);
}
$image->optimizeImageLayers();
$image->setCompression(imagick::COMPRESSION_JPEG);
$image->setImageFormat("jpg");
$image->setInterlaceScheme(Imagick::INTERLACE_PLANE);
$image->stripImage();
$image->setImageCompressionQuality(0);
$image->writeImage($feed_diretory);
$image->destroy();
/* ------------------
/ Story
/ ---------------- */
$image = new Imagick();
$title = new ImagickDraw();
$call_to_action = new ImagickDraw();
$website = new ImagickDraw();
$pixel = new ImagickPixel('white');
$image->newImage(720, 1280, $pixel);
$thumbnail = new Imagick($photo_diretory);
$thumbnail->scaleImage(3000, 1280, true);
$thumbnail_width = $thumbnail->getImageWidth();
$thumb_position_x = (720 - $thumbnail_width) / 2;
$bg_story = new Imagick();
$bg_story->readImage(PTGEN_PLUGIN_PATH . "assets/images/story.png");
$logo_position_x = 360 - ($logo->getImageWidth() / 2);
$image->compositeImage($thumbnail, imagick::COMPOSITE_OVER, ceil($thumb_position_x), 0);
$image->compositeImage($bg_story, imagick::COMPOSITE_OVER, 0, 0);
if ($pg_options['pg_story_title_custom_position_options'] == 'auto-adjust') {
$image->compositeImage($logo, imagick::COMPOSITE_OVER, ceil($logo_position_x), 1080);
} else {
$image->compositeImage($logo, imagick::COMPOSITE_OVER, ceil($logo_position_x), 1180);
}
$title->setFillColor($pg_options['pg_story_font_color']);
$title->setFont(PTGEN_PLUGIN_PATH . 'assets/fonts/Inter-Bold.ttf');
$title->setFontSize(35);
$title->setTextAlignment(\Imagick::ALIGN_CENTER);
list($lines, $lineHeight) = ptgen_word_wrap($image, $title, $text, 600);
$text_height = sizeof($lines) * $lineHeight;
switch ($pg_options['pg_story_title_custom_position_options']) {
case 'auto':
$title_position_y = 1280 - (180 + $text_height);
break;
case 'figure':
$title_position_y = 1280 - (350 + $text_height);
$figure = new Imagick();
$figure->readImage(PTGEN_PLUGIN_PATH . 'assets/images/figure.png');
$figure->scaleImage(390, 113, true);
$figure->evaluateImage(Imagick::EVALUATE_MULTIPLY, 0.2, Imagick::CHANNEL_ALPHA);
$image->compositeImage($figure, imagick::COMPOSITE_OVER, 150, 930);
break;
case 'pixel':
$title_position_y = $pg_options['pg_story_title_custom_position'];
break;
case 'auto-adjust':
default:
$title_position_y = 1280 - (280 + $text_height);
break;
}
for ($i = 0; $i < count($lines); $i++) {
$image->annotateImage($title, 350, $title_position_y + $i * $lineHeight, 0, $lines[$i]);
}
$call_to_action->setFillColor($pg_options['pg_color_call_to_action']);
$call_to_action->setFont(PTGEN_PLUGIN_PATH . 'assets/fonts/Inter-Bold.ttf');
$call_to_action->setFontSize(28);
$call_to_action->setTextAlignment(\Imagick::ALIGN_CENTER);
list($lines, $lineHeight) = ptgen_word_wrap($image, $call_to_action, $call_to_action_text, 600);
$cta_y = ($pg_options['pg_story_title_custom_position_options'] == 'auto-adjust') ? 1015 : 1110;
for ($i = 0; $i < count($lines); $i++) {
$image->annotateImage($call_to_action, 350, $cta_y + $i * $lineHeight, 0, $lines[$i]);
}
$website->setFillColor($pg_options['pg_color_call_to_action']);
$website->setFont(PTGEN_PLUGIN_PATH . 'assets/fonts/Inter-Bold.ttf');
$website->setFontSize(28);
$website->setTextAlignment(\Imagick::ALIGN_CENTER);
list($lines, $lineHeight) = ptgen_word_wrap($image, $website, $call_to_action_website, 600);
$website_y = ($pg_options['pg_story_title_custom_position_options'] == 'auto-adjust') ? 1060 : 1155;
for ($i = 0; $i < count($lines); $i++) {
$image->annotateImage($website, 350, $website_y + $i * $lineHeight, 0, $lines[$i]);
}
$image->optimizeImageLayers();
$image->setCompression(imagick::COMPRESSION_JPEG);
$image->setImageFormat("jpg");
$image->setInterlaceScheme(Imagick::INTERLACE_PLANE);
$image->stripImage();
$image->setImageCompressionQuality(0);
$image->writeImage($story_diretory);
$image->destroy();
unlink($photo_diretory);
$images = array(
'feed' => get_site_url() . '/wp-content/plugins/post-generator/files/feed-' . $hash . '.jpg',
'feed_facebook' => get_site_url() . '/wp-content/plugins/post-generator/files/feed-facebook-' . $hash . '.jpg',
'story' => get_site_url() . '/wp-content/plugins/post-generator/files/story-' . $hash . '.jpg'
);
return $images;
}
return false;
}
Do petróleo a renováveis no Brasil: o grupo Shell inicia negociações para implementar usinas solares no Brasil já em 2023 - G Click Petroleo e Gas
Início
/
Energia Renovável
/
Do petróleo a renováveis no Brasil: o grupo Shell inicia negociações para implementar usinas solares no Brasil já em 2023
2 min de leitura
Do petróleo a renováveis no Brasil: o grupo Shell inicia negociações para implementar usinas solares no Brasil já em 2023
Publicado em
10/06/2020 às 07:05
A grande major do petróleo e gás global, a Royal Dutch Shell Plc, começará em breve negociações com potenciais clientes para vender a produção futura de suas primeiras usinas solares no Brasil, que poderão iniciar a produção em 2023.
Os projetos fazem parte de um grande portfólio que já está em desenvolvimento em vários estados do país, disse à Reuters a gerente de desenvolvimento de negócios de energia solar da Shell na América Latina, Maria Gabriela da Rocha.
“Nos últimos dois anos, focamos principalmente na construção de nosso portfólio. Agora começaremos a conversar com os clientes com produtos em mãos para oferecer ”
— ARTIGO CONTINUA ABAIXO —
Maria Gabriela da Rocha.
Essa iniciativa faz parte da estratégia da Shell de ingressar no setor de energia renovável, pois as indústrias querem cada vez mais contratos de energia limpa de longo prazo. Enquanto a estratégia do grupo no Brasil se concentra no desenvolvimento de projetos próprios, a multinacional não descarta aquisições no setor, diz o relatório.
Um desses projetos latentes que estão com as obras prestes a iniciarem é a construção da Termoelétrica Marlim Azul, na cidade de Macaé – RJ , também conhecida como a “cidade do petróleo”
Quando perguntado sobre o tamanho do portfólio brasileiro de energia renovável da empresa, Rocha disse que é um “tamanho da Shell”.
Em abril, a Shell apresentou à Aneel, reguladora do setor elétrico do Brasil, um plano para o desenvolvimento de 130 MW de projetos fotovoltaicos (PV).
Shell está com processos seletivo sem várias funções
O empresa Rizen, que pertence ao grupo Shell, está com vagas de emprego em diversas funções nas áreas operacionais, técnica e engenharia
Soldador Mecânico Industrial Eletricista Engenheiro de Manutenção Técnico em Manutenção Engenheiro de Projetos
e a matéria completa e confira as possibilidades.
[gs-fb-comments]
Paulo Nogueira
Eletrotécnica formado em umas das instituições de ensino técnico do país, o Instituto Federal Fluminense - IFF ( Antigo CEFET), atuei diversos anos na áreas de petróleo e gás offshore, energia e construção. Hoje com mais de 8 mil publicações em revistas e blogs online sobre o setor de energia, o foco é prover informações em tempo real do mercado de empregabilidade do Brasil, macro e micro economia e empreendedorismo. Para dúvidas, sugestões e correções, entre em contato no e-mail informe@clickpetroleoegclickpetroleoegas-br.diariodoriogrande.com.br. Vale lembrar que não aceitamos currículos neste contato.
Mais comentados
Populares
Recentes
Compartilhe nas redes sociais
Este site utiliza cookies para melhorar a experiência do usuário. Saiba mais
Rejeitar
Aceitar