Tamamlanmış

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;

}

}

Beceriler: PHP, WordPress , MySQL, JavaScript, CSS

Daha fazlasını gör: 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

İşveren Hakkında:
( 70 değerlendirme ) port orange, United States

Proje NO: #32205986

Seçilen:

(85 Değerlendirme)
6.8

Bu iş için 10 freelancer ortalamada $21 teklif veriyor

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.

1 gün içinde %bids___i_sum_sub_32%%project_currencyDetails_sign_sub_33% USD
(272 Değerlendirme)
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 Daha Fazla

$25 USD in 7 gün içinde
(75 Değerlendirme)
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 Daha Fazla

$25 USD in 7 gün içinde
(141 Değerlendirme)
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 gün içinde
(105 Değerlendirme)
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!

1 gün içinde %bids___i_sum_sub_32%%project_currencyDetails_sign_sub_33% USD
(75 Değerlendirme)
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.

1 gün içinde %bids___i_sum_sub_32%%project_currencyDetails_sign_sub_33% USD
(3 Değerlendirme)
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 Daha Fazla

$25 USD in 7 gün içinde
(1 Yorum)
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.

1 gün içinde %bids___i_sum_sub_32%%project_currencyDetails_sign_sub_33% USD
(0 Değerlendirme)
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 gün içinde
(0 Değerlendirme)
0.0