Færdiggjort

Rewrite code that saves file as png SO it saves as GIF (code in description/file attached)

currently have a meme generator on my website.. it allows me to add jpeg templates... i want to be able to use .gif files instead... but when i save it, it saves as jpg file. i need it to save gif only.

please analyze code below and let me know if u have the skills for this.

code:

/**

* Process image

*

* @param str $img the file input name.

* @param int $post_id the post ID (with 0 there is no post attached).

* @param str $post_title the post title.

*/

public function mememe_process_image( $img, $post_id = 0, $post_title = 'meme###' ) {

if ( ! $img ) {

return false;

}

if ( ! function_exists( 'media_handle_upload' ) ) {

require_once( ABSPATH . 'wp-admin/includes/[login to view URL]' );

require_once( ABSPATH . 'wp-admin/includes/[login to view URL]' );

require_once( ABSPATH . 'wp-admin/includes/[login to view URL]' );

}

// $upload_dir = wp_upload_dir()

$img = str_replace( 'data:image/png;base64,', '', $img );

$img = str_replace( ' ', '+', $img );

$data = base64_decode( $img );

$source = imagecreatefromstring( $data );

if ( false !== $source ) {

// Set a custom upload directory.

add_filter( 'upload_dir', array( $this, 'custom_upload_dir' ) );

$upload_dir = wp_upload_dir();

$upload_path = str_replace( '/', DIRECTORY_SEPARATOR, $upload_dir['path'] ) . DIRECTORY_SEPARATOR;

// Reflect the meme slug.

$meme_slug = mememe_admin()->get_option( 'mememe_option_slug', 'mememe' );

$base_title = 'meme###' == $post_title ? $meme_slug : sanitize_title( $post_title );

$image_name = $base_title . '-' . $post_id . '.jpg';

$image_upload = imagejpeg( $source, $upload_path . $image_name, 100 );

// @new use $file instead of $source

$file = array();

$file['error'] = '';

$file['tmp_name'] = $upload_path . $image_name;

$file['name'] = $image_name;

$file['type'] = 'image/png';

$file['size'] = filesize( $upload_path . $image_name );

// Upload file to server.

$file_return = media_handle_sideload( $file, $post_id );

imagedestroy( $source );

// Reset to default uploads directory.

remove_filter( 'upload_dir', array( $this, 'custom_upload_dir' ) );

return $file_return;

} else {

return false;

}

}

Evner: PHP, WordPress, MySQL, JavaScript, CSS

Se mere: doxygen png jpg gif file size, excel description dependent code, myspace upcoming events description html code, gif image header code, j2me games description source code, website flex animated gif logo html code website, description ardrone_navigation code, rewrite creative title small description keywords photos, attached code, animated png vs gif, imagemagick convert png to gif, animated png to gif, convert gif to html code, python convert png to gif, png to gif, description of code 94799, rename png to gif, convert png to gif animation, convert gif to embed code

Om arbejdsgiveren:
( 70 bedømmelser ) port orange, United States

Projekt ID: #32205986

Tildelt til:

(85 bedømmelser)
6.8

10 freelancere byder i gennemsnit $21 timen for dette job

TopSEOExpertscom

Hi, I've checked the attached code and I can get it done for you so that it saves as GIF. Thanks and I look forward to working with you.

$35 USD på 1 dag
(272 bedømmelser)
7.9
vbtise

We can do it! Professionals are accessible 24/7/365 to guide you. Honestly, I possess all the skills and experience that you're looking for. I'm pretty confident that I am the best candidate for this job role. It's no Flere

$25 USD in 7 dage
(75 bedømmelser)
7.4
baniksubir1

Dear Hiring Manager , Today your job posting (Rewrite code that saves file as png SO it saves as GIF (code in description/file attached)) has caught my attention, and I wish to have a conversation about the project. I Flere

$25 USD in 7 dage
(141 bedømmelser)
6.7
ShrineWeb

I have some questions regarding the specs that you have provided. Could we please have a word? My Skills: PHP, WordPress, CSS, MySQL and JavaScript

$10 USD in 7 dage
(105 bedømmelser)
6.4
gustavofulanetto

Hi, I've changes to your script that I think they'll get the generated images converted from jpg to gif. I'd like you to contact me on the chat so I can send you the code for you to test it. Thanks!

$20 USD på 1 dag
(75 bedømmelser)
5.1
Olamide1987

Greetings~ I have seen your code so I have a confidence in your task. Please contact me and let me work. Thanks. Olamide.

$10 USD på 1 dag
(3 bedømmelser)
1.6
DWSol

Hi, • This is Sairus Khalil from DW Solution online. • I'm certified in web designing and development by freelancer.com. You can also check certificate in my profile. • DW Solution Online is providing Responsive Webs Flere

$25 USD in 7 dage
(1 bedømmelse)
0.0
saikumarg8

I have 3 years of experience in python, django, php. I can edit this code and run it with in one day.(24hrs). Please let me know if intrested.

$25 USD på 1 dag
(0 bedømmelser)
0.0
smit245

hey i can fix your problem for you. i will just send you the code after doing updates in it and it will work fine

$10 USD in 7 dage
(0 bedømmelser)
0.0