On Sat, Jan 30, 2010 at 2:51 AM, Kevin <[email protected]> wrote:
> What it the proper way to use this to re-upload replacement images and
> files?
>
> I've had to resort to just plain ftp'ing the replacement files as I have not
> been able to get this to work while attempting to get the right images to
> work with a page or update a graphic that has out of date info in it.
It was only really designed for files, but I could perhaps tweak the
code to do something similar for images. Well, might involve a fairly
complex rewrite...
With non-image files you just add the &reload=true to the url and then
click the little red ^ to get a re-upload screen. I will look into
making it also work for images...
...
Ok, it wasn't that hard. Here is the code for the last half of the
BOLTMuploads function (markups.php, ~827). I made several
simplifications and improvements. Seems to work in my limited tests.
Let me know if you notice any problems. (Watch out for email generated
linebreaks) I'll add into the next release...
Cheers,
Dan
$dir = '';
if (isset($args['dir'])) {
$dir = $args['dir'];
if (BOLTfilter($dir, '/^[-_a-zA-Z0-9\/]+$/') == '') return
BOLTtranslate(BOLTinfoVar('site.messages', 'invalid_dir',
'Unauthorized upload directory.'));
$location = "$BOLTfilesDir/$dir/$file";
$dirLink = "&dir=$dir";
}
else $location = "$BOLTfilesDir/$file";
if (isset($args['label'])) $label = $args['label'];
else $label = $file;
if (! file_exists($location)) $location = strtolower($location);
if (! file_exists($location)) $location = "$imgPath/$file";
if (file_exists($location)) {
if (substr($location, 0, strlen($imgPath)) != $imgPath)
$location =
$fieldURL . $location;
if (! BOLTauth($file, $BOLTid, 'files')) return 'File access
blocked';
if ($args['reload'] == 'true' || $_GET['reload'] == 'true') {
if (! isset($BOLTreloadMark)) $BOLTreloadMark =
"<span
class='marks'><sup>^</sup></span>";
$reload = BOLTescape("<a
href='$scriptURL$pageLink$fileLink&action=upload&file=$file$dirLink'
rel='nofollow'>$BOLTreloadMark</a>");
}
if (strpos('jpg,gif,png', substr(strrchr($file, "."), 1)) !==
false) {
if (!isset($args['alt'])) $attr .= "alt='' ";
if (file_exists($location)) {
if (strpos($attr, 'height=') === false &&
strpos($attr, 'width=')
=== false) {
$size = getimagesize($location);
$attr .= $size[3];
}
}
return BOLTescape("<img src='$location' $attr
/>$reload");
}
else return BOLTescape("<a href='$location' $attr>") .
"$label</a>$reload";
}
else {
$label = $label . $BOLTmissingUpload;
return BOLTescape("<a
href='$scriptURL$pageLink$fileLink&action=upload&file=$file$dirLink'>")
. "$label</a>";
}
}
--
You received this message because you are subscribed to the Google Groups
"BoltWire" 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/boltwire?hl=en.