GravityForm preview thumbnails for the multifile upload field - wordpress

I want to display the preview thumbnail of the multifile upload field. I had followed this thread but I found that {fileName} had some random string. It’s between {input id} and {file.target_name}.
Ex: 4a017277_input_5_zfKuGrwCd91CyiHy_o_1esroacel59uais19ev1dqa405q.png.
What is {zfKuGrwCd91CyiHy}?
tmp image's name

I had found a solution for this. It's not a beautiful way but it worked like a champ.
The random string above was rendered by a function random_str(). My solution is to remove or customizing the function.
File located at path: ../wp-content/plugins/gravityforms/includes/upload.php
enter image description here

Related

NextGEN Gallery - Permalink Issue - urlencode Hebrew

In file products/photocrati_nextgen/modules/nextgen_basic_imagebrowser/package.module.nextgen_basic_imagebrowser.php, on line 74 you have a check to find the current image.
The relevant code is:
if ($picture->image_slug == $pid)
The thing is that $pid is a clean string, and $picture->image_slug is URL-encoded.
For example, $pid is מיראז-1 while $picture->image_slug is %d7%9e%d7%99%d7%a8%d7%90%d7%96-1.
If you upload an image with a filename in Hebrew/Arabic - the result is that you always only see the first image in the imagebrowser.
The plugin can't show any other image, besides the first. Both with or without AJAX.
I went through all of the filters and actions possible with the plugin,
but it only affects the logic after this part that I was referring to.
Any thoughts on this?

How can I display WPAlchemy post meta in my custom wordpress template?

I am using the WPAlchemy class to create a meta box for my custom post type which includes image upload fields. The setup works and I can add image and save the images url for each post. I setup everything as shown here: http://www.farinspace.com/wpalchemy-metabox/#installsetup
How do I now display the saved image meta url on my page? Ideally I would like to be able to display as an image on the page by adding the image's url to image src so it displays the image not the link. However I would be happy to just display the url on the page to start to make sure it's present. But I am really stuck knowing how to echo or print the info to the page. I have tried following some of their examples but nothing seems to be working and I sometimes get php errors saying:
Fatal error: Call to a member function the_name() on a non-object in C:\
Any help appreciated. I thought it would be easier than it is, like the_meta() or something similar but it's not clear what to add to get the info showing up on page.
Cheers
Best things to do is use:
global $custom_mb;
$meta = $custom_mb->the_meta([ID_IS_OPTIONAL]);
$meta will be an array of all your stored values for the given post, loop through it as you normally would loop an array

Unable to generate the derived image using image_style_url

Im seeing the following message within Reports when I attempt to use the image_style_url function on an image : "Unable to generate the derived image located at public://..."
I have ensured that the directory is under Apache's ownership and I have no problems attaching images for upload to other nodes.
The style name "template" has been set up within the "Image Styles" menu in the Drupal Administration panel.
When the function is called, an image URL is being returned but the image is not displaying because the image is not being created by the server.
Does anyone have any ideas as to how I can fix this issue?
I am simply printing image_style_url, where "thumbnail" is a name given to the image style that was created in the admin area.
$img_url = $node->field_image[0]['uri'];
print image_style_url("thumbnail", $img_url);
I just had had this problem generating sites/default/files/styles/newsletter_thumbnail/public/Scotland_bankers_2.jpg - it turned out that the file Scotland_bankers_2.jpg didn't exist in the /files/ folder so there was nothing to generate!
The $img_url your passing may be invalid. Check if uri value is accessible.
Do you have multiple images in one field?
I think you should be accessing the data like this:
$node->field_image[$node->language][0]['uri']
I encountered the same error before when my image was deleted.
did u set a style for that image ?
this is how to print the img from a custom template
$style='full_content_width';
$path=$node->my_img_field['und']['0']['uri'];
$style_url = image_style_url($style, $path);
print "<img src=".file_create_url($style_url)." >";

using Views_get_view_result to return imagefield contents, but how do I get the path?

how do I grab images from a node using php? I"m using views_get_view_result to retrieve the array from Views and for the image field I get a serialized string:
a:2:{s:3:"alt";s:20:"south pacific poster";s:5:"title";s:0:"";}
it contains no reference as to where the image is located or the name of the image. In Views the image displays properly in the preview area.
Thanks
ah! Views has an option for URL to File
Its hard to tell exactly what you are doing, but you can get the filepath from the fid with something like:
<?php
$r = db_result(db_query('select filepath from files where fid=%d',$fid));

How would you recommend adding an image as a custom field in WordPress?

I need to add an image to each page in WordPress.
I don't wish to insert it using the WYSIWYG editor, I just need the url as a custom field, which I later use in the template.
I tried using the CFI plugin (Custom Field Images), and I hacked my way into getting it to work with the rest of my plugins, but then I moved the site to the production server and CFI just didn't work for some reason.
I can't seem to find any other plugin that just lets you pick an image from the library and add it as a custom field.
I've downgraded to the point where I'm willing to manually enter all the URLs into each and every page. but before I do, I thought I'd check here.
Can anyone tell me what's the easiest, best way to add images as custom fields in WordPress (2.7.1 if it matters)?
In our WordPress template, each post generally only has one image 'attached', which is displayed outside the posts' (textual) content.
I simply upload the file using the edit posts' media uploader, never insert it into the post like JoshJordan above, then retrieve the image using a bit of code in the right place in my template file.
This would also work if you're using more than one image in your post, eg. in your post content. As long as you keep the image used as the 'main' post image as the first image (remember you can re-order images in your posts' image library by dragging them up and down), you're easily able to call it anywhere in your template file by using something like this:
<?php
$img_size = 'thumbnail'; // use thumbnail, medium, large, original
$img_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts where post_parent= $post->ID and (post_mime_type = 'image/jpeg' OR post_mime_type = 'image/gif') and post_type = 'attachment'");
$img_array = wp_get_attachment_image_src($img_id,$img_size,false);
echo '<img src="'.$img_array[0].'"' title="'.get_the_title().'" />';
?>
No need for copying and pasting image urls.
The template I have uses a manually-entered custom field for the splash image of each post. When I'm done writing my article, I upload an image, copy its URL from the upload tool, never insert it into my post, and then paste that URL into the "Image" custom field. Simple as pie and takes only seconds. Insignificant compared to the amount of time it takes me to write an article.
You can use the custom key value fields on posts as well. let's say you always give your images the key 'thumb'. you can then use this code to output them in your post as a thumbnail:
<?php
$values = get_post_custom_values("thumb");
echo “<img src=\”$values[0]\” class=\”thumb\”></a>”; ?>
Consider using Flutter it's a bit tricky to figure out at first, and has many really useful featured, including EIP (edit in place), and image handling.
After installing the plugin create a new "Write Panel", you'll figure it out from there. The plugin provides you with a rather intuitive GUI, which includes an image uploader. The template tags are very easy to use, I believe it's something like
<?php echo get_image('name_of_field'); ?>
I just had to build a site for a client that needed the same feature, I ended up using Flutter.

Resources