Laravel and Glide renaming an image - php

I've implemented Laravel Clyde https://github.com/antennaio/laravel-clyde which is an wrapper for Glide https://github.com/thephpleague/glide
This set-up works for uploading, caching and retrieving images etc. However I need to be able to rename an image when it's downloaded.
I cannot see a way of doing this using these packages.

I think one of the purposes of clyde is to abstract those manipulation configurations. If you just use glide then the image filename will look nice but the user sees those messy params. One solution might be to serve the file without clyde on a view that shows the full picture.

Related

Symfony 2 MediaBundle file upload tutorial wanted, how to start?

I'm new with Symfony and MediaBundle, can't find tutorial how to upload files to server using MediaBundle, only display. Video would be perfect. I'm using latest Symfony 2.5. I need simple file upload, without any Sonata Media Bundle, or I must use Sonata for upload?
Only official example I found:
http://symfony.com/doc/current/cmf/bundles/media/introduction.html#uploading-files
and no working code examples.
For uploading, I use the OneupUploaderBundle and use jQuery for my front end. Uploading can be involved because you have to handle different interfaces on users and then also have a method to save files on your server. This bundle allows you to use different front ends for the design and has sever nice events for handling different types of uploads.
I use the included oneup_uploader.pre_upload event to review the file that will be uploaded and use oneup_uploader.post_upload to have the file's name stored in a related entity so I can easily access it from a controller/service. It has some decent examples but post any questions if you are stuck. One of the most useful features for me is the custom logic for uploads.

How to get thumbnail images in zend framework

I have larger images stored in one folder. I dont want to create thumbnail images, store it some place and retrieve. I am looking for script to create thumbnail images of larger images dynamically and display in the browser but never storing the thumbnail image on the server.
Could someone recommend me some links to tutorial or provide me script to do so? I have found phpthumb() http://phpthumb.sourceforge.net/ doing such work in php. How could I use it zend framework or other library, please recommend
Edit : How to use phpthumb() http://phpthumb.sourceforge.net/ ?
phpthumb() has a bunch of class files. To generate thumbnail in phpthumb() we only require to write the following line:
<img src="phpthumb.php?src=image.jpg&w=150"/>
I want to use it in zend framework. Where should I place this library? Placing inside the library folder, I would have to rename all the classes and its references. How to do use it? any other techniques
If you are willing to provide HTTP access to your source images, you could use a free service like TinySrc, to provide thumbnails. Neither Zend Framework v1, or Zend Framework v2, provides support for image manipulation that I can see.

Amazon S3 folder manipulation with PHP

I have one instance in Amazon EC2. It is a Photobook. User can signup and upload images and they can create a photobook. S for that we want S3 storage. I searched a lot for a good PHP class to manipulate these folders, images and html files.
Now I have no idea how we can create folder, delete folder and search for a folder.
Can anyone help find a solution for these folder/image manipulation requirements like create , search, delete?
The official PHP SDK?
http://aws.amazon.com/sdkforphp/
http://aws.amazon.com/php/
Good question. I was trying to do it now and didn't found the answer in any documentation.
So I discovered that you just need to send the entire path in $keyname parameter:
folder/my_file_name.jpg
The S3 service can recognize and creates automatically the folders.
I think as me, you were looking for a method create_folder-like.
Easy and tricky.

Simple PHP image gallery with file upload

I am looking for a really simple PHP image gallery system that allows file uploads and provides easy integration into any existing PHP script. I only found full galleries with database backend and templating systems for integration and the too simple ones that just take a folder with (FTP uploaded) images and show it but don't provide the possibilities for file uploads.
I'm quite close on writing my own, cause I didn't find anything yet, but I first wanted to ask if you have any suggestions.
Ok so I have a very early version of it on Github, it is under development (and not really nice yet, I just needed the admin interface up and running) but contributions and comments are welcome.

is it right to save media file of project into svn repository?

I know that I can save all my projects files into repository so deployment of new version of software become only using svn export into properly directory.
But I have a feeling that it is not right way and for media files I should use some other utilities for deployment like rsync. But it is also a problem with double-side sync = I like to keep backup of full projects into some security space (not only live server).
So main question is what is the right way and project's directory structure for web-application in PHP?
Ehh, a complex one.
First of all, if you have such possibility, it's good to split 'code' and 'web' part. Something like that.
web/
web/css/
web/upload
code/
code/lib/
code/actions
This gets PHP out of web root. It's safer (attacer will not be able to access your files by entering URL in browser). BUT - this requires appropriate application design (for example Symfony framework gives you similar layout).
Second thing - there's nothing wrong (in my opinion) with binary files inside SVN repo. It all depends, though, what files we are talking about. If not user-uploaded content - go ahead. The less complex is deployment, the less chance something goes wrong.
BTW: You can always opt-out some folders contents from svn so user files won't mess up with your files.
So one thing you have to keep in your design is to separate user entered content of your content (the best is to create special folders for users and opt them out SVN).
It's absolutely right to put media files into source control (whether svn or something else). It's probably a good idea to put media files somewhere separate from your .php files though.
Why have a two step deployment (svn up and then rsync or similar) when you can do it in one step?
It's not wrong to have your media files into your SVN repository, as your medias' version is linked to the rest of your software's.
Besides, if you want to have backups of your svn repository, you can use the svnsync command to have some other box mirror you "main" subversion repository.
About structure, the best practice mainly depends on the use case you are facing. You most likely want to organize your files by modules and content-type (so having media separated from code, ...).
It's fine to put the media files in svn too.
You could use for example external svn links to blend the media files into your tree, so you have only one checkout to do and you have full subversion support and you do not clutter your sourcecode repository.
In my opinion, it depends on what type of media you are talking about. If this is something static, like images, javascript, css, and so forth - something that isn't temporary, then put it in subversion. However, if it is something that will change, such as an ad, I don't think there is much reason to subversion it. Just set the directory propset to ignore and upload the files manually with rsync, scp or ftp.

Categories