SilverStripe GD Image and Text - php

I'm looking for a solution to have this kind of functionality to work on silverstripe:
http://papermashup.com/demos/php-gd-image-and-text/
Basically I would like to make an object on the back (page) with uploadable fonts and base image and then on the front end (for any user) I would like to have a form with font chooser (from fonts I've uploaded for this particular page) - finally it will generate the image with some text.
I can't find any solution for SilverStripe.

This sounds rather like you're asking for help with a particular solution, and not with a specific issue that you're having.
What have you tried so far? Did you check https://addons.silverstripe.org? What did you find?
What you're asking is totally possible, and off the top of my head requires a a custom subclass of GDBackend which will interact with GD directly, a custom Controller comprising a single public method who's logic calls your custom GD logic to generate the image, and some basic jQuery+AJAX to POST the form-field values into your controller.

Related

Symfony2 Sonata Media Bundle Custom Image Cropping

It seems that Sonata Media has only two strategies when it comes to cropping/resizing the uploaded image, Sonata\MediaBundle\Resizer\SimpleResizer and Sonata\MediaBundle\Resizer\SquareResizer. Both these strategies are automatic, meaning that the users don't have a say in how they want the image to be resized/croppped.
I would like to give the user an option to select the portion of the image that is more relevant, kind like the jQuery Image Cropper library used by GenemuFormBundle, but I don't even know where to start. Will I need to create my own Admin class instead of using Sonata\MediaBundle\Admin\BaseMediaAdmin? Has anyone write a bundle that I can use? How do you manage your galleries usually?
You should look at ComurImageBundle. It's far easier than Sonata Media, doesn't create anything in database and lets you upload with jquery file uploader, crop with jcrop and other useful things.
I wrote a simple admin extension that give you the ability to customize the images by format. It's actually a Work In Progress that needs some test, documentation and refactoring, but it does the job, it's lightweight and it's shipped with a resizer to handle fixed dimensions.
You can find it here: https://github.com/julien-maitan/sonata-media-crop
If you are using sonata media bundle with sonata admin, there is a picasa photo editor already in place in media edit form.
Please check.

What is the best way to display user input as a custom font on a website?

I'm building a site for a custom vinyl shop, and I want to build a simple app that allows people to enter their desired text in an input box, choose a certain font, and then choose the pattern/color.
I've been looking into using Imagemagick or more specifically, Imagick for use with PHP. But I've seen some posts on here about using Gmagick and also ImageTTFtext. Just wondering what people feel is the best solution for my needs before I dive in.
You may want to import fonts via CSS (and write a certain class for each font) and add that class to the input field instantly using ajax when people choose a that font.

Drupal 7:replace original image with ImageStyles generated image

I'm using regular imagefields on various content types in a Drupal 7 social website (and also on the user profile pictures via http://drupal.org/project/imagecache_profiles). For cropping I'm using http://drupal.org/project/imagecrop as an image style effect.
I would like to replace the original image with the one generated from the imagecrop style. How do you replace the original image from a user (the one that gets used for subsequent image styles when you say call it in views) with one that is created from an image style effect?
I'm not sure the best way to approach this problem, which is why I posted question.
To make sure I'm being clear -
A User uploads a large image (say 2,000 pixels by 1300 pixels) via a regular imagefield.
Using image styles, I perform some effects (specifically javascript crop, but this could be generic) and then replace the original image with the one generated from the image style.
All additional image styles (different sizes etc) use the new original images and are derived from it.
I think this can be done easily using a custom module and they must have used something like the image editor project - See drupal.org/project/imageeditor, just not sure what hooks to use or how to jump in on this. Any advice, tips or direction would be great.
Check module - Original image with style
I believe you can address your problem by making changes under the display settings for your field:
/admin/structure/types/manage/[your content type machine name here]/display

Wordpress - Dynamically Process Image

I have images uploaded in the media library in WordPress. I would like to show the images with text composited on top of them using PHP's GD or something similar.
If this were just a plain old PHP site, I could create a URL with a search parameter for the text and center it over my image with GD and serve it up. In WordPress, I am a little unclear how to accomplish this. I am not sure if it fits well into the concepts of Posts and Pages.
I can perform the programming myself. I am just looking for some pointers on how to get started.
Thanks,
Carl
You can do that in WordPress, too. It's mostly just a plain old PHP site. For example, you could create a PHP file that creates the composite given the text and the image and use it like: <img src="/composite.php?image=...&text=...">.
Maybe all of the images are on a particular page or post type. Then you could create a custom page or post-type template that parses the $post->post_content for the images, does the compositing, and alters the image tags to point to the new composited images.
Or, more generally in that vein, create a filter for the_content that does that for all posts.
You might be able to hook into the WordPress upload system. As images are uploaded, you could create the composite. The wp_handle_upload filter might work for that.
Or you could even create a WordPress cron job that scans the media uploads for new entries and creates the composites then.

HTML snippet within Zend_Form

I'm using Zend_Form as part of a simple signup process. In part 1 of 2 the user is able to upload a number of images. In part 2 - for each one of these images - I ask the user to add further details - an additional 4 text fields grouped together using addDisplayGroup. Within each display group I want to display a thumbnail of the uploaded image. I have generated these thumbs and all the processing is complete but i'm unsure what the best approach is for displaying the image within the relevant section. I guess its possible to create a custom form element to display this but somehow this feels like overkill considering the image is purely being used for display purposes. I also dont really want to replace $this->form->render() with a manual outputting of the form. Could this be achieved with a decorator maybe? I'm still fairly new to ZF so any ideas would be much appreciated.
Thanks.
You would use a custom decorator in your decorator stack for the display group. Or you could use the HtmlTag decorator.
http://framework.zend.com/manual/en/zend.form.forms.html#zend.form.forms.displaygroups
there is an excelent example for an Custom image "Preview" Element:
Zend Form with Image
Or try the Zend_Form_Element_Image shipped with the Framework
Zend Form Element Image

Categories