Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

updating readme and console image paths

  • Loading branch information...
commit 02affb82611a9a3fd354e4fcb6b1ed02c162c72b 1 parent 3f03b53
Jeff Reifman authored
View
9 core/classes/images.class.php
@@ -29,11 +29,10 @@ function fetchImage() {
$imgArr=explode('.',$image);
if (isset($_GET['fixed'])) $fixed=$_GET['fixed']; else $fixed=''; // fix x or y dimension
if (isset($_GET['crop'])) $crop='c'; else $crop=''; // crop the height
- $file_cache_path=PATH_CACHE.'/scaleImg_'.$imgArr[0].'_'.$dx.'_'.$dy.'_'.$fixed.$crop.'.jpg';
- //$this->db->log($file_cache_path);
+ $file_cache_path=PATH_CACHE.'/'.CACHE_PREFIX.'_imgSc_'.$imgArr[0].'_'.$dx.'_'.$dy.'_'.$fixed.$crop.'.jpg';
if (file_exists($file_cache_path)) {
// try reading cached file
- header("Content-type: image/jpg");
+ header("Content-type: image/jpeg");
readfile($file_cache_path);
} else {
$this->scaleImage($imgArr[0],$imgArr[1],$path,$x,$y,$dx,$dy,$fixed,$crop,$file_cache_path);
@@ -134,11 +133,11 @@ function scaleImage($image='',$imageType='jpg',$path='default',$x=0,$y=0,$dx=0,$
}
Imagejpeg( $destImage,$file_cache_path,100);
if ($this->prepWritableFile($file_cache_path)) {
- header("Content-type: image/jpg");
+ header("Content-type: image/jpeg");
readfile($file_cache_path);
} else {
// if all caching fails, output directly
- header("Content-type: image/jpg");
+ header("Content-type: image/jpeg");
imagejpeg($destImage);
}
imagedestroy($srcImage);
View
29 facebook/images/scaleImage.php
@@ -9,10 +9,10 @@
$dy=$y;
if (isset($_GET['fixed'])) $fixed=$_GET['fixed']; else $fixed=''; // fix x or y dimension
if (isset($_GET['crop'])) $crop='c'; else $crop=''; // crop the height
- $file_cache_path=PATH_CACHE.'/scaled_'.$imageid.'_'.$dx.'_'.$dy.'_'.$fixed.$crop.'.jpg';
+ $file_cache_path=PATH_CACHE.'/'.CACHE_PREFIX.'_imgSc_'.$imageid.'_'.$dx.'_'.$dy.'_'.$fixed.$crop.'.jpg';
if (file_exists($file_cache_path)) {
// try reading cached file
- header("Content-type: image/jpg");
+ header("Content-type: image/jpeg");
readfile($file_cache_path);
} else {
require_once(PATH_CORE.'classes/db.class.php');
@@ -23,7 +23,18 @@
// else create a new scaled image
$file_orig=$data->url; // old PATH_CACHE.'/story_'.$imageid.'.jpg';
if ($file_orig=='') $file_orig=PATH_SITE_IMAGES.'watermark.jpg';
- $srcImage = imagecreatefromjpeg($file_orig);
+ $imageType=getExtension($file_orig);
+ switch ($imageType) {
+ default:
+ $srcImage = imagecreatefromjpeg($file_orig);
+ break;
+ case 'gif':
+ $srcImage = imagecreatefromgif($file_orig);
+ break;
+ case 'png':
+ $srcImage = imagecreatefrompng($file_orig);
+ break;
+ }
list($srcWidth, $srcHeight) = getimagesize($file_orig);
$srcWidth>$srcHeight?$layout='landscape':$layout='portrait';
if (($layout=='landscape' AND $srcWidth<$dx) OR ($layout=='portrait' AND $srcHeight<$dy)) {
@@ -75,11 +86,11 @@
}
Imagejpeg( $destImage,$file_cache_path,100);
if (prepWritableFile($file_cache_path)) {
- header("Content-type: image/jpg");
+ header("Content-type: image/jpeg");
readfile($file_cache_path);
} else {
// if all caching fails, output directly
- header("Content-type: image/jpg");
+ header("Content-type: image/jpeg");
imagejpeg($destImage);
}
imagedestroy($srcImage);
@@ -87,6 +98,14 @@
}
}
+ function getExtension($str) {
+ $i = strrpos($str,".");
+ if (!$i) { return ""; }
+ $l = strlen($str) - $i;
+ $ext = substr($str,$i+1,$l);
+ return $ext;
+ }
+
function prepWritableFile($file_path) {
if (file_exists($file_path) && is_writable($file_path)) {
return true;
View
10 php/console/views/templates/select_templates.php
@@ -1,26 +1,26 @@
<div class="yui-g"><h2>Select the template you would like to use.</h2></div>
<div class="yui-b"><div class="yui-g"> <div class="yui-u first">
<div class="template" style="border: 1px solid black; padding: 10px;">
- <img width="250px" src="?p=img&img=console/template_1.jpg" onclick="return loadTemplate('template_1');" />
+ <img width="250px" src="?p=img&img=template_1.jpg" onclick="return loadTemplate('template_1');" />
</div>
<div class="spacer"><br /></div>
<div class="template" style="border: 1px solid black; padding: 10px;">
- <img width="250px" src="?p=img&img=console/template_2.jpg" onclick="return loadTemplate('template_2');" />
+ <img width="250px" src="?p=img&img=template_2.jpg" onclick="return loadTemplate('template_2');" />
</div>
<div class="spacer"><br /></div>
<div class="template" style="border: 1px solid black; padding: 10px;">
- <img width="250px" src="?p=img&img=console/template_3.jpg" onclick="return loadTemplate('template_3');" />
+ <img width="250px" src="?p=img&img=template_3.jpg" onclick="return loadTemplate('template_3');" />
</div>
<div class="spacer"><br /></div>
<!-- YOUR DATA GOES HERE -->
</div>
<div class="yui-u">
<div class="template" style="border: 1px solid black; padding: 10px;">
- <img width="250px" src="?p=img&img=console/template_4.jpg" onclick="return loadTemplate('template_4');" />
+ <img width="250px" src="?p=img&img=template_4.jpg" onclick="return loadTemplate('template_4');" />
</div>
<div class="spacer"><br /></div>
<div class="template" style="border: 1px solid black; padding: 10px;">
- <img width="250px" src="?p=img&img=console/template_5.jpg" onclick="return loadTemplate('template_5');" />
+ <img width="250px" src="?p=img&img=template_5.jpg" onclick="return loadTemplate('template_5');" />
</div>
<div class="spacer"><br /></div>
<!-- YOUR DATA GOES HERE -->
View
2  php/console/views/templates/template_1.php
@@ -1,7 +1,7 @@
<div class="yui-b">
<div class="yui-g">
<h1>Template Builder for template 1</h1>
-<img src="?p=img&img=console/template_1.jpg" />
+<img src="?p=img&img=template_1.jpg" />
<br />
<div id="template-1" class="template" style="border: 1px solid black; padding: 10px; width: 500px; height: 150px;">
<input type="hidden" value="0" id="story-1-story-id" name="story-1-story-id" />
View
2  php/console/views/templates/template_2.php
@@ -1,7 +1,7 @@
<div class="yui-b">
<div class="yui-g">
<h1>Template Builder for template 2</h1>
-<img src="?p=img&img=console/template_2.jpg" />
+<img src="?p=img&img=template_2.jpg" />
<br />
<div id="template-2" class="template" style="border: 1px solid black; padding: 10px; width: 500px; height: 215px;">
<input type="hidden" value="0" id="story-1-story-id" name="story-1-story-id" />
View
2  php/console/views/templates/template_3.php
@@ -1,7 +1,7 @@
<div class="yui-b">
<div class="yui-g">
<h1>Template Builder for template 3</h1>
-<img src="?p=img&img=console/template_3.jpg" />
+<img src="?p=img&img=template_3.jpg" />
<br />
<div id="template-3" class="template" style="border: 1px solid black; padding: 10px; width: 500px; height: 315px;">
<div class="story-1-template">
View
2  php/console/views/templates/template_4.php
@@ -1,7 +1,7 @@
<div class="yui-b">
<div class="yui-g">
<h1>Template Builder for template 4</h1>
-<img src="?p=img&img=console/template_4.jpg" />
+<img src="?p=img&img=template_4.jpg" />
<br />
<div id="template-4" class="template" style="border: 1px solid black; padding: 10px; width: 500px; height: 280px;">
<div class="yui-u first">
View
2  php/console/views/templates/template_5.php
@@ -1,7 +1,7 @@
<div class="yui-b">
<div class="yui-g">
<h1>Template Builder for template 5</h1>
-<img src="?p=img&img=console/template_5.jpg" />
+<img src="?p=img&img=template_5.jpg" />
<br />
<div id="template-5" class="template" style="border: 1px solid black; padding: 10px; width: 500px; height: 460px;">
<input type="hidden" value="0" id="story-1-story-id" name="story-1-story-id" />
View
0  php/console/images/banner.jpg → php/images/banner.jpg
File renamed without changes
View
0  php/console/images/loading.gif → php/images/loading.gif
File renamed without changes
View
0  php/console/images/template_1.jpg → php/images/template_1.jpg
File renamed without changes
View
0  php/console/images/template_2.jpg → php/images/template_2.jpg
File renamed without changes
View
0  php/console/images/template_3.jpg → php/images/template_3.jpg
File renamed without changes
View
0  php/console/images/template_4.jpg → php/images/template_4.jpg
File renamed without changes
View
0  php/console/images/template_5.jpg → php/images/template_5.jpg
File renamed without changes
View
4 php/img.php
@@ -3,7 +3,7 @@
// serves image files via HTTP
if (isset($_GET['img'])) {
$img=$_GET['img'];
- streamImage(PATH_PHP_IMAGES.'/'.$img);
+ streamImage(PATH_PHP_IMAGES.$img);
}
function streamImage($path='')
@@ -12,7 +12,7 @@ function streamImage($path='')
$pi=pathinfo($path); // ,PATHINFO_EXTENSION
switch ($pi['extension']) {
default:
- $contentType='image/jpg';
+ $contentType='image/jpeg';
break;
case 'gif':
$contentType='image/gif';
View
3  readme.txt
@@ -33,6 +33,9 @@ Please also follow us on twitter @newscloud: http://twitter.com/newscloud
Release Notes
---------------------------------------------
+v0.32 - Facebook PHP Open Source Releases Jan 15, 2009
+ * Minor patch release to v0.31 related to console and console images
+
v0.31 - Facebook PHP Open Source Releases Jan 6, 2009
* Updated documentation and sample settings to make configuration easier for more environments
* Patch release to v0.30
View
2  sites/default/constants_sample.php
@@ -125,7 +125,7 @@
/* PHP Module Settings */
define ("MODULE_PHP","FACEBOOK");
define ("PATH_PHP",SRC_ROOT.'/php/');
- define ("PATH_PHP_IMAGES",SRC_ROOT.'/sites/images/');
+ define ("PATH_PHP_IMAGES",SRC_ROOT.'/php/images/');
define ("PATH_PHP_TEMPLATES",SRC_ROOT.SRC_SITE.'/php/templates');
define ("PATH_PHP_STYLES",PATH_PHP.'styles'); // or, move to /styles directory for site-specific approach
define ("PATH_PHP_SCRIPTS",PATH_PHP.'scripts');
Please sign in to comment.
Something went wrong with that request. Please try again.