create_error($access_token, 'PHP', 'get_artists.php', 'No user found', $db); die('No user found'); } $user_row = mysql_fetch_array($user, MYSQL_ASSOC); $galleryId = $user_row['gallery_id']; $galleryFolder = 'gallery_' . $galleryId . '/'; $galleryDirectory = $destination_folder . $galleryFolder; $result_artists = mysql_query("select * from artist where gallery_id = '" . $galleryId . "'", $db); $json_response_artists = array(); while ($row = mysql_fetch_array($result_artists, MYSQL_ASSOC)) { $row_array['id'] = $row['id']; $row_array['slug'] = $row['id']; $row_array['name'] = utf8_encode($row['name']); $row_array['imgName'] = utf8_encode($row['img']); $row_array['imgPath'] = getImgPath($galleryFolder, $galleryDirectory, utf8_encode($row['img'])); $row_array['imgOverviewPath'] = getImgOverviewPath($galleryDirectory, utf8_encode($row['img'])); $row_array['location'] = utf8_encode($row['location']); $row_array['description'] = utf8_encode($row['description']); if ($row['display'] == 1 || $row['display'] == '1') { $row_array['display'] = true; } else { $row_array['display'] = false; } $result_artworks = mysql_query("select * from artwork where artist_id= '" . $row_array['id'] . "'", $db); $row_array['artworks'] = array(); while ($row_artwork = mysql_fetch_array($result_artworks, MYSQL_ASSOC)) { array_push($row_array['artworks'], intval($row_artwork['id'])); } $row_array['artworksQty'] = sizeof($row_array['artworks']); array_push($json_response_artists, $row_array); }
$success = $image->cropThumbnailImage($max_thumb_size, $max_thumb_size); if (!$success) { create_error($access_token, 'PHP', 'create_artist_img.php', 'Fail to crop the image thumbnail.', $db); die('Fail to crop the image thumbnail.'); } else { //Upload the thumbnail image $thumb_save_folder = $destination_folder . $galleryDirectory . $imgName . $thumb_suffix . '.' . $image_extension; $success = $image->writeImage($thumb_save_folder); if (!$success) { create_error($access_token, 'PHP', 'create_artist_img.php', 'Fail to upload the image thumbnail.', $db); die('Fail to upload the image thumbnail.'); } chmod($thumb_save_folder, 0644); $result_artist_imgOverviewPath = mysql_query("select img from artist where gallery_id = '" . $galleryId . "' and id = '" . $artistId . "'", $db); while ($row = mysql_fetch_array($result_artist_imgOverviewPath, MYSQL_ASSOC)) { $imgOverview = getImgOverviewPath($destination_folder . $galleryDirectory, utf8_encode($row['img'])); } if ($imgOverview || mysql_num_rows($gallery) > 0) { echo json_encode($imgOverview); } else { create_error($access_token, 'PHP', 'create_artist_img.php', 'No thumbnail image found. Try again!', $db); die('No thumbnail image found. Try again!'); } } } } } else { create_error($access_token, 'PHP', 'create_artist_img.php', 'No valid image found.', $db); die('No valid image found.'); } } else {