Author: uncleringo
Date: 2010-05-24 17:53:35 +0200 (Mon, 24 May 2010)
New Revision: 29605
Modified:
plugins/sfDoctrineJCroppablePlugin/trunk/lib/doctrine/JCroppable.php
Log:
Claire's fix for not returning a link to a broken (non-existent) image
Modified: plugins/sfDoctrineJCroppablePlugin/trunk/lib/doctrine/JCroppable.php
===================================================================
--- plugins/sfDoctrineJCroppablePlugin/trunk/lib/doctrine/JCroppable.php
2010-05-24 13:49:16 UTC (rev 29604)
+++ plugins/sfDoctrineJCroppablePlugin/trunk/lib/doctrine/JCroppable.php
2010-05-24 15:53:35 UTC (rev 29605)
@@ -186,9 +186,9 @@
* @return string
*/
private function getImageDirWeb() {
- $webDir = str_replace('\\', '/', sfConfig::get('sf_web_dir'));
- $imageDir = str_replace('\\', '/', $this->getImageDir());
-
+ $webDir = str_replace('\\', '/', sfConfig::get('sf_web_dir'));
+ $imageDir = str_replace('\\', '/', $this->getImageDir());
+
return (string)str_replace($webDir . '/', '', $imageDir);
}
@@ -209,9 +209,16 @@
print("image upload directory <strong>$fileDir</strong> is not
writable");
}
- $fileSrc = '/' . $fileDir . '/' . $this->getImageFromName($fieldName,
$size);
-
- return $fileSrc;
+ //if there is no pic do not return the broken markup
+ if ($this->getImageFromName($fieldName, $size) != false)
+ {
+ $fileSrc = '/' . $fileDir . '/' . $this->getImageFromName($fieldName,
$size);
+ return $fileSrc;
+ }
+ else
+ {
+ return false;
+ }
}
/**
@@ -224,13 +231,20 @@
*/
public function getImageTag($fieldName, $size = 'thumb', $attributes =
array())
{
- return tag(
- 'img',
- array_merge(
+ if ($this->getImageSrc($fieldName, $size) != false)
+ {
+ return tag(
+ 'img',
+ array_merge(
$attributes,
array('src' => $this->getImageSrc($fieldName, $size))
- )
- );
+ )
+ );
+ }
+ else
+ {
+ return '';
+ }
}
/**
--
You received this message because you are subscribed to the Google Groups
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/symfony-svn?hl=en.