function getImageName($image_path) { $image_path = preg_replace('/\\s/', '_', Text::transliterate($image_path)); if (file_exists($image_path)) { preg_match('/(.*?)\\.([a-zA-Z09]{3,4})$/', $image_path, $pocket); if (preg_match('/\\((\\d+)\\)$/', $pocket[1], $match)) { $pocket[1] = preg_replace('/\\((\\d+)\\)$/', '(' . ($match[1] + 1) . ')', $pocket[1]); } else { $pocket[1] .= '(1)'; } $image_path = $pocket[1] . '.' . $pocket[2]; $image_path = getImageName($image_path); return $image_path; } else { return $image_path; } }
<?php echo 'OS: '; $os = getHostOS($device); if ($os != $device['os']) { log_event('Device OS changed ' . $device['os'] . " => {$os}", $device, 'system'); $device['os'] = $os; $sql = dbUpdate(array('os' => $os), 'devices', 'device_id=?', array($device['device_id'])); echo "Changed OS! : {$os}\n"; } $icon = getImageName($device, false); if ($icon != $device['icon']) { log_event('Device Icon changed ' . $device['icon'] . " => {$icon}", $device, 'system'); $device['icon'] = $icon; $sql = dbUpdate(array('icon' => $icon), 'devices', 'device_id=?', array($device['device_id'])); echo "Changed Icon! : {$icon}\n"; }
function getImageSrc($device) { global $config; return $config['base_url'] . '/images/os/' . getImageName($device) . '.png'; }
echo '<table id="tablesorter1" class="tablesorter" border="1" cellspacing="0" cellpadding="3" width="100%">'; echo "<thead>\n<tr valign='top'>\n"; echo "<th>".$this->lang->line('kago_id')."</th>\n<th>".$this->lang->line('kago_name')."</th><th>Image</th><th>Image Size</th>" ."<th>".$this->lang->line('kago_status')."</th><th>".$this->lang->line('kago_actions')."</th>\n"; echo "</tr>\n</thead>\n<tbody>\n"; foreach ($slideshow as $key => $list){ echo "<tr valign='top'>\n"; //echo "<td align='center'>".form_checkbox('p_id[]',$list['id'],FALSE)."</td>"; echo "<td align='center'>".$list['id']."</td>\n"; echo "<td align='center'>"; //.$list['name']. echo anchor('slideshow/admin/edit/'.$list['id'],$list['name']); echo "</td>\n"; $subject = $list['image']; $imagename = getImageName($subject); $imagepath = getImagePath($subject); //$filepath = base_url()."assets/images/frontpage/".$list['name']; $filepath = base_url().$imagepath; //$imagepath = "assets/images/frontpage/".$list['name']; echo "<td class='tableimg'><img width=\"70px\" src='".$filepath."' /></td>"; echo "<td>"; if ($imagepath!="") $filesize = getimagesize($imagepath); // print_r ($filesize); echo "width: ".$filesize[0]. "px<br />"; echo "height: ".$filesize[1]. "px<br />"; echo "</td>"; echo "<td align='center'>"; $active_icon = ($list['status']=='active'?'tick':'cross');
function getImageSrc($device) { global $config; return 'images/os/' . getImageName($device) . '.png'; }
//Check to see if any images with the same names already exist if (file_exists($large_image_location)) { if (file_exists($thumb_image_location)) { $thumb_photo_exists = "<img src=\"" . $upload_path . $thumb_image_name . "\" alt=\"Thumbnail Image\"/>"; } else { $thumb_photo_exists = ""; } $large_photo_exists = "<img src=\"" . $upload_path . $large_image_name . "\" alt=\"Large Image\"/>"; } else { $large_photo_exists = ""; $thumb_photo_exists = ""; } if (isset($_POST["upload"])) { //Get the file information $userfile_name = $_FILES['image']['name']; $userfile_name = getImageName($_FILES['image']['name'], 'something'); $userfile_tmp = $_FILES['image']['tmp_name']; $userfile_size = $_FILES['image']['size']; $filename = basename($_FILES['image']['name']); $file_ext = substr($filename, strrpos($filename, '.') + 1); //Only process if the file is a JPG and below the allowed limit if (!empty($_FILES["image"]) && $_FILES['image']['error'] == 0) { if ($file_ext != "jpg" && $userfile_size > $max_file) { $error = "ONLY jpeg images under 1MB are accepted for upload"; } } else { $error = "Select a jpeg image for upload"; } //Everything is ok, so we can upload the image. if (strlen($error) == 0) { if (isset($_FILES['image']['name'])) {
exit("Usage: brimg.php INPUT_DIR OUTPUT_DIR [CONFIG_FILE]\n"); } $input = $_SERVER['argv'][1]; $output = $_SERVER['argv'][2]; $configFile = isset($_SERVER['argv'][3]) ? $_SERVER['argv'][3] : 'brimg.json'; if (!file_exists($configFile)) { exit("Config file \"" . $configFile . "\" does not exist.\n"); } if (!file_exists($output)) { mkdir($output); } $config = json_decode(file_get_contents($configFile), true); $generateAll = isset($config['generate-all']) ? $config['generate-all'] : true; foreach (new DirectoryIterator($input) as $fileInfo) { if (in_array($fileInfo->getExtension(), ['jpg', 'jpeg', 'png', 'gif'])) { $imageName = getImageName($fileInfo); foreach ($config['sizes'] as $size) { $outputFile = sprintf('%s/%s%s-%s%s.%s', $output, isset($size['prefix']) ? $size['prefix'] : '', $imageName, $size['name'], isset($size['suffix']) ? $size['suffix'] : '', $fileInfo->getExtension()); if ($generateAll || !file_exists($outputFile)) { exec(sprintf('gm convert -resize %s %s %s', $size['width'], $fileInfo->getPathname(), $outputFile)); } } } } /** * @param SplFileInfo $fileInfo * * @return string Name of file without path and extension. */ function getImageName(\SplFileInfo $fileInfo) {
} } $galleries = getGalleries($_SESSION['user_id']); $galleryId = array_values(getGalleriesIds(array($_GET['id']), 'slike.txt'))[0]; //napravi izbor korisnikovih galerija $options = array(); foreach ($galleries as $key => $value) { if ($key == $galleryId) { array_push($options, create_element("option", true, ["contents" => $value, "value" => $key, "selected" => "selected"])); } else { array_push($options, create_element("option", true, ["contents" => $value, "value" => $key])); } } $input = create_select(["name" => "galleryOption", "contents" => $options]); $pictureId = $_GET['id']; $pictureTitle = getImageName($pictureId); $pictureDescription = getImageDescription($pictureId); echo create_element("img", false, ["src" => "picture.php?id={$pictureId}&size=original"]); ?> <form id='pic_upload' action='' method='post' accept-charset='UTF-8'> <fieldset> <legend>Edit your picture</legend> <input type='hidden' name='submitted' id='submitted' value='1'/> <label for='title'>Title*: </label> <input type='text' name='title' id='title' value=<?php echo $pictureTitle; ?> maxlength="100" required/><br> <br> <label for='description'>Description:</label>