wordpress image a la une €8-30 EUR Publicado hace casi 10 años
€8-30 EUR Pagado a la entrega
Bonjour,
J'ai un bug sur une fonction d'attachement d'une image à la une sur wordpress téléchargée avec curl, le fichier ce télécharge bien dans la bibliothèque mais l'attachement ne fonctionne pas..
Voici le code :
$post_id = wp_insert_post( $my_post );
// Fetured Image inspired by GPL code of Tsai I-Ta [login to view URL]
$imageUrl = $value[5];
// Get image from url & check if is an available image
// Get the file name
$filename = substr($imageUrl, (strrpos($imageUrl, '/'))+1);
if (!(($uploads = wp_upload_dir(current_time('mysql')) ) && false === $uploads['error'])) {
echo "upload errors";
}
// Generate unique file name
$filename = wp_unique_filename( $uploads['path'], $filename );
// Move the file to the uploads dir
$new_file = $uploads['path'] . "/$filename";
$c = curl_init();
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_URL, $imageUrl);
$file_data = curl_exec($c);
curl_close($c);
if (!$file_data) {
echo "missing image file data";
}
file_put_contents($new_file, $file_data);
// Set correct file permissions
$stat = stat( dirname( $new_file ));
$perms = $stat['mode'] & 0000666;
@ chmod( $new_file, $perms );
$wp_filetype = wp_check_filetype( $filename, $mimes );
extract( $wp_filetype );
if ( ( !$type || !$ext ) && !current_user_can( 'unfiltered_upload' ) ) {
return null;
}
$url = $uploads['url'] . "/$filename";
$attachment = array(
'post_mime_type' => $type,
'guid' => $url,
'post_parent' => null,
'post_title' => $filename,
'post_content' => '',
);
$thumb_id = wp_insert_attachment($attachment, $filename, $post_id);
if ( !is_wp_error($thumb_id) ) {
require_once(ABSPATH . '/wp-admin/includes/[login to view URL]');
// Added fix by misthero as suggested
wp_update_attachment_metadata( $thumb_id, wp_generate_attachment_metadata( $thumb_id, $new_file ) );
update_attached_file( $thumb_id, $new_file );
}
Seriez vous capable de trouver ce bug et sous quel tarif et delais? Merci
ID del proyecto: 6230688
Información sobre el proyecto 6 propuestas
Proyecto remoto
Activo hace 10 años
¿Buscas ganar dinero? Dirección de email Postular a trabajos similares Beneficios de presentar ofertas en Freelancer Fija tu plazo y presupuesto
Es gratis registrarse y presentar ofertas en los trabajos
6 freelancers están ofertando un promedio de €29 EUR por este trabajo
Ready to start "Right Now"
Give me chance to prove my ability and also quality work
i am waiting your positive replay from your side
i am highly interested to work with you
€38 EUR en 1 día
4,9 (682 comentarios) hello i can do fix this issue with great perfection and timely manner as per your requirement. please discuss in message.
€14 EUR en 1 día
4,8 (139 comentarios) Hi, I am ready to start it. But i have some questions for you. So kindly leave message for me, then i'll discuss it in depth.
€29 EUR en 1 día
4,9 (186 comentarios) Dear Sir,
Award the project to get the work start.
I have total 4 years of experience in php/wordpress/html/css. I have gone through your little requirement. Please check my reviews and feedback for your reference.
Thanks & Regards
eGlobalSoft
€22 EUR en 1 día
4,8 (77 comentarios) A proposal has not yet been provided
€10 EUR en 5 días
0,0 (0 comentarios)