Conversation
supportHello, I like the plugin as it is easy and works just the way I need. I have 2 ideas for the further development: 1. I miss the option to choose Error Correction level as it is predefined to “H” level 2. The ouptut HTML code is missing ALT parameter which is not compliant with HTML definition The solution is quite simple – see below. I appretiate if you extend the official plugin code somehow this way: function autoqrcode_func($atts) { $upload = wp_upload_dir(); $upload_dir = $upload['basedir']; $upload_dir = $upload_dir . '/autoqrcode/'; $size = isset($atts['size']) ? $atts['size'] : 3; $margin = isset($atts['margin']) ? $atts['margin'] : 4; $name = str_replace(' ', '', wp_qrcode_clean($atts['qrcode']) . $size . $margin); // added ECLEVEL param switch ($atts['eclevel']) { case 'L': $eclevel = QR_ECLEVEL_L; break; case 'M': $eclevel = QR_ECLEVEL_M; break; case 'Q': $eclevel = QR_ECLEVEL_Q; break; case 'H': default: $eclevel = QR_ECLEVEL_H; } if (!file_exists($upload_dir . $name . '.png')) { // added $eclevel attribute QRcode::png($atts['qrcode'], $upload_dir . $name . '.png', $eclevel, $size, $margin); } $get_img = $upload['baseurl'] . '/autoqrcode/' . $name . '.png'; // added ALT attribute, added "" for SRC $alt = isset($atts['alt']) ? $atts['alt'] : 'QR code'; return '<img src="'.$get_img.'" alt="'.$alt.'">'; } This topic was modified 5 years, 3 months ago by kubaalbrecht .
No comments were stored for this source.