Tal vez no sea la mas ortodoxa o tenga algún bug de seguridad pero me funcionado de maravilla Big Grin

function portalimg_upload($input_img, $path = "uploads/posts/", $img_error = FALSE) {
	$input_img = preg_replace("#script:#i", "", $input_img);
	$ext = get_extension($input_img);	
	$input_img = file_get_contents($input_img);	
	if(preg_match("#^(gif|jpg|jpeg|jpe|bmp|png)$#i", $ext)) {
		$filename_1 = gmdate("Y_m")."_".TIME_NOW.".".$ext;
		$filename = $path.$filename_1;
		$temp = $path.md5(time().rand()); 
		$f = @fopen($temp, 'wb');
		if (!($f = @fopen($temp, 'wb'))) { 
			$img_error = TRUE;  
		} 
		fwrite($f, $input_img); 
		fclose($f); 
		if (!@rename($temp, $filename)) { 
			@unlink($filename); 
			@rename($temp, $filename); 
		}  
		@my_chmod($path.$filename, '0644');
	}
	else {
		$img_error == TRUE;
	}
	$portal_array = array(
		"error" => $img_error,
		"src"		=> $filename_1,
	);
	return $portal_array;
}

Si ven algún fallo de seguridad me gustaría que me lo hicieran saber Big Grin
Puedes obtener el contenido de la imagen después de verificar que la extensión es valida.
Envía un DM o MP si te interesa patrocinar alguna actualización o complemento a alguno de mis plugins.

[Image: signature.png]


Discord omar.gonzalez (Omar G.#6117); Telegram at @omarugc;
Buen punto, gracias por avisarme de ese detallito

Enviado desde mi móvil utilizando Tapatalk 2