milesj / transit Goto Github PK
View Code? Open in Web Editor NEWA lightweight file uploading library with image transformation and remote storage support.
License: MIT License
A lightweight file uploading library with image transformation and remote storage support.
License: MIT License
Hi,
I'm facing some exceptions in rollback()
, sometimes $file is not an object (happened when I used your Uploader plugin).
To solve it please changed:
if ($files = $this->getAllFiles()) {
foreach ($files as $file) {
$file->delete();
}
}
Into:
if ($files = $this->getAllFiles()) {
foreach ($files as $file) {
if($file) {
$file->delete();
}
}
}
Hey
I'm using you library (which is awesome btw) but I'm having some dependency resolution problems with the aws version that Transit includes depends on an older version of the Guzzle client which results in conflicts that can't be resolved.
Is it possible to bump the aws/aws-sdk-php
version to at least 2.1.0
?
Thanks!
Setting CURLOPT_SSL_VERIFYPEER to false is a bad idea unless the developer explicitly set it. See Issue #7
As of CURL 7.10 the default is true
I'm using the Uploader plugin to upload css and js files, but I've had to comment out the file_info() check for mime type in Transit/File.php because it returns the wrong type. It seems this is an issue with certain strings in the files that confuse the lookup database.
See: https://bugs.php.net/bug.php?id=53035
I'm seeing similar results to these folks - when uploading JS with opening comments it returns "text/x-c" as the type and my file goes from "script.js" to "script.c". I've set $ext = null in that method for now to get around the check so that it takes it from the extension.
I appreciate this being a security feature for user file uploads but my particular form is creating the file from a text input so I have control over the extension. It seems file_info() mime types are currently broken for text based files.
Since theres a massive price competition between cloud providers. I've switched my site over to using Rackspace CloudFiles. Was wondering if you could add CloudFiles support to Transit and Uploader.
https://github.com/rackspace/php-opencloud/blob/master/docs/userguide/ObjectStore/Storage/Object.md
When using Transit with other plugins such as Uploader please make it so developers can choose a CA bundle that has custom self signed certs verified in.
Hey! First off thank you for sharing transit :-)
As I can see, in Transit/Transporter/Aws/S3Transporter.php:166, file is always being deleted after successful upload to s3.
Maybe it'd be better to have this behavior as an option?
For example, I wanna upload the same file to s3 and rackspace (redundancy in case s3 is unavailable).
But I don't like the idea to extend this class over a simple option.
What do you think?
When I uploaded the .exe file that I renamed the extension to .pdf, validation failed to recognize the .exe file and thought the file was a .pdf file
'Uploader.FileValidation' => array(
'file' => array(
'extension' => array('pdf'),
'type' => 'application',
'mimeType' => array('application/pdf'),
'required' => true
)
),
my solution was added mime checking using finfo_open at AbstractValidator -> mimeType
public function mimeType($whitelist = array()) {
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$mime = finfo_file($finfo, $this->getFile());
return in_array($mime, (array) $whitelist);
}
Sidenote: I'm using transit via deprecaed CakePHP Uploader Plugin on Linux.
Imagine an URL like: http://server/image.php?id=12312
\Transit\File::type()
will perform the following steps:
$type
is first determined via file -b --mime ...
and gets detected as image
$ext = $file->ext()
will return text/x-php
$type !== $extType
$type
will be forced to be the file extension type, basically ignoring the actual content typeThis behaviour is problematic as serving an image via such an URLs is perfectly legit.
One approach could be to only use the extension if either the file -b --mime...
and the finfo_file()
logic do not work.
I used Uploader plugin with Transit plugin for Image staff in my project. I think I found little bug while resizing large images (large dimensions) to very small thumbnails. I was uploading image with dimensions 2000x2675px. My config was set to transform image to max 320x240px (width x height) and maintain aspect ratio when scaling down/up with width mode. But after the transformation, the image was re-sized to exactly 320x240px and the image was distorted.
Fix could be on the line 70 and 71 in the file "src/Transit/Transformer/Image/ResizeTransformer.php" with removing round() functions and leaving the code like this:
$widthScale = $width / $baseWidth;
$heightScale = $height / $baseHeight;
I'm using your Uploader plugin with Transit in a CakePHP project. Great work.
The rename
function in the File
class doesn't check if the new file name already exists. This could causes an overwriting of files especially if the preg_replace
method removes some unwanted characters. I think there should be also a check like in the move
function.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.