Bought a theme from NickDevas. in that not able to upload image from its short codes.
While debugging the code i found this function.
may i know is there any issue there
public function nd_visualshortcodes_media_upload_image() {
$query = \Drupal::entityQuery('file')->sort('fid', 'DESC')->range(0, 500);
$entitys = $query->execute();
$output = '<div class="nd-visualshortcodes-gallery-links">';
$output .= '<form id="ajax-dackend-image-form"><div class="js-form-item form-item js-form-type-file form-type-file js-form-item-files-style-background-image form-item-files-style-background-image">
<label for="edit-style-background-image">Upload Image</label>
<input class="image-image-upload-vc js-form-file form-file" onchange="nd_visualshortcodes_upload_img(this)" data-drupal-selector="edit-style-background-image" id="edit-style-background-image" name="files[style_background_image]" size="60" type="file">
<span class="field-suffix"><i class="fa fa-spinner fa-spin loading hidden"></i></span>
</div></form> <hr><ul id="list-item-images">';
foreach ($entitys as $file) {
$img = File::load($file);
if ($img) {
if (!file_destination($img->getFileUri(), FILE_EXISTS_ERROR)) {
if ($img->getMimeType() == "image/jpeg" || $img->getMimeType() == "image/png" || $img->getMimeType() == "image/gif") {
$filename = $img->getFileUri();
$medium = ImageStyle::load('thumbnail')->buildUrl($filename);
$files[] = array("link" => $medium, "id" => $file);
$output .= '<li><a href="#" class="gallery-links" data-id="' . $file . '" data-link="' . $medium . '" ><img src="' . $medium . '"></a></li>';
// $output .='<a href="#" class="galimage" >dddd'.$file.'</a>';
}
}
}
}
$output .= '</ul></div><script>jQuery(function($){
$("ul#list-item-images").easyPaginate({
step:16,nextprev:false
});
});</script>';
return new Response($output);
}
Closed: won't fix
2.0
User interface
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.