| 10 |
*/ |
*/ |
| 11 |
|
|
| 12 |
|
|
|
/* function pblog_menu($may_cache) { |
|
|
$items = array(); |
|
|
// After every change to this unload and reload module and run update.php |
|
|
if ($may_cache) { |
|
|
// www.example.com/pblog/829/picture.jpg |
|
|
$items[] = array('path' => 'pblog', 'title' => t('Pblog'), |
|
|
'callback' => 'pblog_image', |
|
|
'access' => user_access('access pblog')); |
|
|
} |
|
|
return $items; |
|
|
} */ |
|
|
|
|
| 13 |
function pblog_menu() { |
function pblog_menu() { |
| 14 |
$items['pblog/%/%'] = array( |
$items['pblog/%/%'] = array( |
| 15 |
'title' => 'Pblog', |
'title' => 'Pblog', |
| 196 |
} |
} |
| 197 |
else $prev_image = $img_array[$current_image - 1]; |
else $prev_image = $img_array[$current_image - 1]; |
| 198 |
|
|
| 199 |
$trans = array("med" => "mini"); |
$trans = array("med" => "strip"); |
| 200 |
$trans2 = array("-med" => ""); |
$trans2 = array("-med" => ""); |
| 201 |
$next_image_url1 = theme_image("$file_dir/pblog/$nid". strtr($next_image1, $trans), 'Next Image', 'Next Image'); |
$next_image_url1 = theme_image("$file_dir/pblog/$nid". strtr($next_image1, $trans), 'Next Image', 'Next Image'); |
| 202 |
$next_image_url = theme_image("$file_dir/pblog/$nid". strtr($next_image, $trans), 'Next Image', 'Next Image'); |
$next_image_url = theme_image("$file_dir/pblog/$nid". strtr($next_image, $trans), 'Next Image', 'Next Image'); |
| 245 |
// for extra debugging drupal_set_message('$file = '. print_r($file, true), 'status'); |
// for extra debugging drupal_set_message('$file = '. print_r($file, true), 'status'); |
| 246 |
} |
} |
| 247 |
else { |
else { |
| 248 |
drupal_set_message("file_save_upload = FAILURE ". print_r($node, true), 'status'); |
drupal_set_message("file_save_upload = FAILURE ". print_r($node, true), 'error'); |
| 249 |
|
drupal_set_message("Your file could not be upload please check it is not bigger than the upload_max_filesize of: ". ini_get(upload_max_filesize), 'error'); |
| 250 |
|
return; |
| 251 |
} |
} |
| 252 |
|
|
| 253 |
// full path to the file |
// full path to the file |
| 257 |
$pblog_dir = file_create_path("/pblog"); |
$pblog_dir = file_create_path("/pblog"); |
| 258 |
if (!file_exists($pblog_dir)) { |
if (!file_exists($pblog_dir)) { |
| 259 |
mkdir($pblog_dir); |
mkdir($pblog_dir); |
| 260 |
|
// can put another check in here |
| 261 |
|
drupal_set_message('Creating Directory '. $pblog_dir, 'status'); |
| 262 |
} |
} |
| 263 |
$image_dir = file_create_path("pblog/$node->nid"); |
$image_dir = file_create_path("pblog/$node->nid"); |
| 264 |
|
|
| 265 |
if (!file_exists("$image_dir")) { |
if (!file_exists("$image_dir")) { |
| 266 |
mkdir("$image_dir"); |
mkdir("$image_dir"); |
| 267 |
|
drupal_set_message('Creating Directory '. $image_dir, 'status'); |
| 268 |
} |
} |
| 269 |
|
|
| 270 |
// check what kind of file it is, zip gzip or just a pic. Then move |
// check what kind of file it is, zip gzip or just a pic. Then move |
| 324 |
$command3 = 'convert -size 500x375 "'. $image_dir .'/'. $s .'" -resize 500x375 +profile "*" "'. $image_dir .'/'. $s_root .'-med.jpg"'; |
$command3 = 'convert -size 500x375 "'. $image_dir .'/'. $s .'" -resize 500x375 +profile "*" "'. $image_dir .'/'. $s_root .'-med.jpg"'; |
| 325 |
exec($command3); |
exec($command3); |
| 326 |
*/ |
*/ |
| 327 |
|
image_scale($image_dir .'/'. $s, $image_dir .'/'. $s_root .'-strip.jpg', 90, 90); |
| 328 |
|
if (file_exists($image_dir .'/'. $s_root .'-strip.jpg')) { |
| 329 |
|
drupal_set_message('Creating strip '. $s_root, 'status'); |
| 330 |
|
} else { |
| 331 |
|
drupal_set_message('Unable to creating thumbnail '. $s_root, 'error'); |
| 332 |
|
} |
| 333 |
|
|
| 334 |
image_scale($image_dir .'/'. $s, $image_dir .'/'. $s_root .'-mini.jpg', 120, 120); |
image_scale($image_dir .'/'. $s, $image_dir .'/'. $s_root .'-mini.jpg', 120, 120); |
| 335 |
|
if (file_exists($image_dir .'/'. $s_root .'-mini.jpg')) { |
| 336 |
|
drupal_set_message('Creating thumbnail '. $s_root, 'status'); |
| 337 |
|
} else { |
| 338 |
|
drupal_set_message('Unable to creating thumbnail '. $s_root, 'error'); |
| 339 |
|
} |
| 340 |
|
|
| 341 |
image_scale($image_dir .'/'. $s, $image_dir .'/'. $s_root .'-med.jpg', 500, 375); |
image_scale($image_dir .'/'. $s, $image_dir .'/'. $s_root .'-med.jpg', 500, 375); |
| 342 |
|
if (file_exists($image_dir .'/'. $s_root .'-med.jpg')) { |
| 343 |
|
drupal_set_message('Creating medium image '. $s_root, 'status'); |
| 344 |
|
} else { |
| 345 |
|
drupal_set_message('Unable to creating medium image '. $s_root, 'error'); |
| 346 |
|
} |
| 347 |
} |
} |
| 348 |
} |
} |
| 349 |
} |
} |
| 353 |
if ($node->nid != '') { |
if ($node->nid != '') { |
| 354 |
system("rm -r pblog/$node->nid"); } |
system("rm -r pblog/$node->nid"); } |
| 355 |
else { |
else { |
| 356 |
print "not a valid node id"; |
drupal_set_message('not a valid node id', 'error'); |
| 357 |
} |
} |
| 358 |
} |
} |
| 359 |
|
|