Search

I agree Nick. In this case if the Entry* delegates were moved to inside commit(), extensions would not have to provide their own delegates :)

This is something to consider for S3 for sure — there should be a clear distinction between UI delegates for manipulating the interface, and Object delegates for manipulating data objects. In my opinion ;-)

This extension does not turn the filename in an url-safe filename (like the file upload field itself does).

When images containing spaces are uploaded using this extension, the spaces will not be escaped, choking lightbox (and some browsers).

@dutch

I’ve been a bit busy lately, but in a few weeks I’ll have time to fix everything, and update it for 2.0.8 (does it work?).

If you, or anyone coming after you, wants to fork the repo and make some changes in the meantime, or don’t feel like doing that, just pass them along!

I’m looking to use this plugin for a project at the moment, everything seems to be ok ( except that meta[creation] line in the extension that I’ve commented out.

However having the spaces in the filename could be an issue, can anyone recommend a fix for this, or is there something we could do in the XSLT to match spaces in the file name and replace with a hyphen in the mean time?

Forgive me also I’m rather (read: very) new at this.

Regarding the spaces, symphony has a function to sanitize the filename. Line 132 of the mass-upload-utility/content/content.inject.php. You can replace

$chkfields[$name][name] = $f;

with

$chkfields[$name][name] = Lang::createFilename($f);

That should work, but I’m not sure if the class is in scope, so I don’t want to push it to the repo without testing it.

My php is very limited, its a good job you stepped in as I was about experiment with changing $f in this line with some sort of string replace.

$new_name = DOCROOT . $dest . '/' . $f;

I’ll test this (yours, not that above) and see what happens.

Hmm that didn’t seem to work, didn’t throw any errors either though.

if that didn’t work, then using preg_replace will:

$chkfields[$name][name] = preg_replace('/s/', '_', $f);

Well I’ve had a bit of fun with this lol.

My PHP skills are non existent in comparison to some of the people on here, I just hope this goes some way to helping improving this plugin which I feel (in some format ) is crucial to Symphony’s success for people like me who want to use it as a good client friendly cms.

Unfortunately scottkf that didn’t work, or didn’t seem to. I’ve had a bit of a hack around and have done the following changes ( which seem to work but I’m not clued up to understand potential pitfalls ), so I’m keen for some of the guru’s to take a look.

117: $new_name = DOCROOT . $dest . '/' . preg_replace('|[^a-zA-Z0-9_-.]|', '-', $f);

132: $chkfields[$name][name] = preg_replace('|[^a-zA-Z0-9_-.]|', '-', $f);

142: $fields[$name][file] = preg_replace("/^/workspace/", '', $dest) . '/' . preg_replace('|[^a-zA-Z0-9_-.]|', '-', $f);

This seems to do the bulk of taking nasty stuff out, I’ve only just done it so I’ll try some more tests.

A quick side effect of this I noticed is that it throw an error saying the source directory wasn’t empty when trying to remove it, it still unlinks the files but I’m not too bothered about it deleting the directory so I’ve just commented this line out:

// already sanitized the sourcedir so no one can accidentally delete stuff // from anywhere but the uploads directory, make sure not to delete mui dir //if ($POST[‘fields’][‘sourcedir’] != ‘/workspace’.$this->driver->getMUI()) { // rmdir(DOCROOT . $_POST[‘fields’][‘sourcedir’]); //}

Sorry I’m aware I’m just tearing this apart with no real jurisdiction to do so but, well I’m actually having fun lol

@scottkf Any chance you may have a fix for the Delegates issue mentioned by myself and discussed with @brendo?

Hi all,

I am trying to use this extension but it seems to not be transferring the image’s dimension.

When I use the mass upload the xml output fails to return any value for the image’s width or height, however when I use the default file upload that information is returned correctly.

Has anyone else experienced this or am I doing something wrong?

Thanks in advance PK

I can verify that none of the meta data is stored, and the mime type is also null which is incorrect.

Ok, on further inspection, The mime type is found by using a shell command. As I’m on windows, that would definitely return NULL.

If the mime type isn’t passed into the getMetaInfo function, it will fail also, which explains this beautifully.

I know Scott probably isn’t going to develop this further, I will look into it as soon as I get a moment…

I really like this extension myself and have a few ideas for changes, so long as Scott is ok with it ;)

I hacked a bit in the extension (I’m still hacking) and got the metadata working.

Try changing

$type = trim(shell_exec('file -b --mime '.escapeshellarg($tmp_name)));

around line 128 to

$type = trim(shell_exec('file -b --mime-type '.escapeshellarg($tmp_name)));

and

$fields[$name][meta] = serialize($this->getMetaInfo(DOCROOT . $fields[$name][file], $type));

in around line 145 to

$fields[$name][meta] = serialize($this->getMetaInfo($tmp_name, $type));

and

$meta['creation'] = DateTimeObj::get('c', filemtime($file));

around line 517 to

$meta['creation'] = DateTimeObj::get('c', time());

I’m not sure about the line numbers because I made some other changes as well.

Cool!

I’ll get this in asap!

Nice one…

Thanks for the quick response.

However, I am still not getting the width and the height of the images, although the creation date is now correctly being returned.

PK

@pk The fix for the time actually isn’t necessary. The reason that the original implementation could’t get the metadata is that it tried to get it from the yet un-copied file. The process of the Mass Upload Utility is to upload the files in a temporary folder and to copy those files in the second step to the defined folder from the upload field. The fix just gets the metadata from the temporary file.

For debugging you should dump the value of $tmp_name. Does it show the path to the temporary image? And what is the value of $type? It should be something like image/jpeg for images and not image/jpeg; charset=binary. I had to change --mime option of the shell command file to --mime-type on my system (Mac OS X), but it may vary on other systems.

@everyone

I’m glad everyone’s using it now! I had problems with the mime type as well, but I don’t use windows-based systems for anything :P

If you have fixes, send a pull request (designermonkey has!) and I’ll get them in right away! If you want to takeover the project, or become a contributor, let me know and I’ll set it up for you.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details