id); if (!isteacher($course->id)) { error("Only teachers can use this functionality"); } $imageurl = rawurldecode($imageurl); /// Full URL starts with $CFG->wwwroot/file.php $imagepath = str_replace("$CFG->wwwroot/file.php", '', $imageurl); $imagepath = str_replace("?file=", '', $imagepath); // if we're using second option of file path. if ($imagepath != $imageurl) { /// This is an internal image $size = getimagesize($CFG->dataroot.$imagepath); } $width = $size[0]; $height = $size[1]; settype($width, "integer"); settype($height, "integer"); if ($height >= 200) { $division = ($height / 190); $width = round($width / $division); $height = 190; } echo "\n"; echo "\n"; echo "\n"; echo "Preview\n"; echo "\n"; echo "\n"; echo "\n"; print "\"\""; echo "\n\n"; ?>