samedi 28 février 2015

App stop working when I click a image

I created an activity with radio button On and Off. When the user click on On the image appears and with Off the image disappear. Everything works fine but when the user accidentally click on the image the app will stop working. There is no on-click function with the image. Please see the code below. XML file:



<RelativeLayout xmlns:android="http://ift.tt/nIICcg"
xmlns:tools="http://ift.tt/LrGmb4" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="com.example.android.Recipe3"
android:onClick="Home"
android:clickable="true">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Beth&apos;s Spicy Oatmeal"
android:id="@+id/textView6"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="1/2 cup butter, softened"
android:id="@+id/textView22"
android:layout_below="@+id/textView6"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="1 cup packed light brown sugar"
android:id="@+id/textView23"
android:layout_below="@+id/textView22"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="1 1/2 cups all-purpose flour"
android:id="@+id/textView24"
android:layout_below="@+id/textView23"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="3 cups rolled oats"
android:id="@+id/textView25"
android:layout_below="@+id/textView24"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="1 teaspoon ground cinnamon"
android:id="@+id/textView26"
android:layout_below="@+id/textView25"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Home"
android:id="@+id/button9"
android:layout_below="@+id/textView26"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:clickable="true"
android:enabled="true"
android:onClick="HomePage" />

<RadioGroup
android:layout_width="120dp"
android:layout_height="49dp"
android:orientation="horizontal"
android:id="@+id/radioGroup2"
android:layout_alignTop="@+id/button9"
android:layout_toRightOf="@+id/textView23"
android:layout_toEndOf="@+id/textView23">

<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="On"
android:id="@+id/radioButton8"
android:checked="true"
android:button="@android:drawable/btn_radio"
android:enabled="true" />

<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Off"
android:id="@+id/radioButton9"
android:layout_gravity="center_horizontal"
android:checked="false"
android:button="@android:drawable/btn_radio"
android:enabled="true"
android:clickable="true" />
</RadioGroup>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Image"
android:id="@+id/textView27"
android:layout_alignBaseline="@+id/button9"
android:layout_alignBottom="@+id/button9"
android:layout_toLeftOf="@+id/radioGroup2"
android:layout_toStartOf="@+id/radioGroup2" />

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView3"
android:src="@drawable/beth"
android:layout_alignParentRight="false"
android:layout_alignParentEnd="false"
android:layout_below="@+id/radioGroup2"
android:layout_marginBottom="-30dp" />
</RelativeLayout>


Java code:



import android.content.Intent;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageView;
import android.widget.RadioGroup;
public class Recipe3 extends ActionBarActivity {
ImageView imageView3;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_recipe3);
imageView3 = (ImageView) findViewById(R.id.imageView3);
RadioGroup radioGroup = (RadioGroup) findViewById(R.id.radioGroup2);

radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
if (checkedId == R.id.radioButton8) {
imageView3.setVisibility(View.VISIBLE);
} else if (checkedId == R.id.radioButton9) {
imageView3.setVisibility(View.GONE);
}
}
});
}



@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_recipe3, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();

//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}

return super.onOptionsItemSelected(item);
}
public void HomePage(View v){
Intent intent=new Intent(v.getContext(),Login.class);
startActivity(intent);
}}

I want to make logo smaller on mobile

newbius maximus here… I want to do css to make logo smaller for mobile , where to start, here is site: http://ift.tt/1K1Uw12


Vertical image split reveal onclick

I've been searching through forums trying to find the best answer for my situation but nothing fits what I'm looking for. I would like to take an image and split it vertically on click. Then to return to the full image, the user would click on either half of the image. I need the image to be able to reveal a div that is larger than the image itself, like a block of text. The best example I can provide is this link here: head-splitting


I'm trying to do the same thing as the link provided. I want to take a face and split it in two, but instead of revealing another image I just want it to reveal a block of text that has info/links within it.


To make things even more complicated, like the example I provided I want the left half of the face to show the inside of the head (a more 3D look). So perhaps it's a matter of taking two images and stacking them?


Lastly (I swear) I want to be able to add CSS hover animations to each of the halves as well as the full version of the image.


Any help you could provide would be greatly appreciated!


Is there anyway to pass Image data through an intent?

I know how to do this converting it to a bitmap, but I want an Image (android.media) on the receiver side.


Thanks in advance.


Rails is not serving up my images

This is not working in my development environment.


I browsed around Google and SO for related posts, and tried everything mentioned here: Rails 4 image-path, image-url and asset-url no longer work in SCSS files


I've tried putting my image in the stylesheets directory, putting it in the images directrory, trying to access it with asset-url, image-url, url, from assets/images/my-image.jpg, images/my-image.jpg, my-image.jpg, assets/my-image.jpg, none of these work. I've checked development.rb in the config/environments and i'm not configured to serve_static_assets, although I'm precompiling some glyphcons in assets.rb and appending some text to that to precompile font files in application.rb, but I don't see how that would keep my images from being sent up by the server.


I checked that my stylesheets were getting sent by restyling some of my page, and they are getting served, so it is an issue of the images not being sent. I have been clearing the cache between test runs, as well, and have been receiving logs in the console that my desired image is searched for but then not found.


Any ideas as to what might be causing this? I'm running Rails 4.0.0 with ruby 2.1.5.


Can't Extract Image From PHP in Python

I'm trying to build a program in Python that will scrape a website for an image and download it, but the website returns this link:


http://ift.tt/1LY8jS1


Which doesn't have a *.jpg or *.png extension. So when I try to use the following code:



import urllib , urllib2, os , sys , time
img = urllib.urlopen("http://ift.tt/1LY8jS1").read()
hand0 = open("test.jpg" , "w")
hand0.write(img)
hand0.close()


It writes an image that looks like this:


http://ift.tt/1LY8ixz


Does anyone know what's going wrong?


Thanks, Ted


How do i make music play when image is clicked?

I have a image that changes the background of the page already but i would also like it to play music when i click the image. Can anyone help? Here's My code


HTML:



<div id="background">
<div id="box">
<div class="button">
<img src="alien.png" type="button" id="my-button">
<br>
<p>Click The Alien!</p>
</div>
</div>


JavaScript:



<script>
var myData = {

1: {
imageUrl: "8.gif",

},

};

function changeImage() {
var randomNumber = Math.floor((Math.random() * 1) + 1);
document.getElementById("background").style.background = "url('" + myData[randomNumber].imageUrl + "')";
document.getElementById("text-box").innerHTML = myData[randomNumber].text;
}
document.getElementById("my-button").addEventListener("click", changeImage);

Intellij IDEA Apache Tomcat. How to edit images?

I'm learning web programming on Java and encountered a problem. I use Intellij Idea with a plugin



<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.1</version>
</plugin>


to run local server and test my code. The thing is I don't know how to edit my images. I use



<div align="center"><img src="Images/logo.jpg"/></div>


and it works fine, but when I decided to change the size of my logo and recopied it to my Images folder Tomcat doesn't see the changes when he stars up. I get the same size jpg as I first copied it there. I think I know what's the problem. My guess is that Tomcat copied it somewhere only once at the first run and doesn't care about any changes in a file with the same name at each next run. He just using the "old" version. But the thing is I don't know how to make him recopy (or something) this file, or any file. Also I couldn't find the path where he stores it to delete it manually and force him to get the "new" version in such a way. Maybe someone can give me an advice?


lag/slowdown when I try to display many images in a listview?

When I have so many images to display in a listview when I flow to the bottom of a picture to another there is a 1 second pause. I save the file path in the sd card in the database sqlite internal adapter and therefore in each element is taken before and after the sqlite database from SD card. How do I not have that annoying lag between an image and another? If I view the image grabbing resources such as (R.drawable.image) this does not bother you, I could make images of sd card reached as to the internal resources to the application? Perhaps accidentally memorize the pictures, I should save them for example in Android / data / com.my.app? (Images except the sd card in pictures folder). How can I improve this?


echo with 5 images as background-image

I have an echo that reads



echo '<img src="'.$images[$key].'" id="layer" />';


It shows 5 semi transparent png's, which the css id lays over each other with a position:absolute.


is there a way to display this specific echo as background-image for the whole page? Thanks.


limit the size of a button with an image

Problem:


I want to create an own widget that uses an image in an button. But the image causes the button to be way to big. How can I resize the button to the normal button size (the size if I use normal Text).

Code:



add = Button(master=controlfrm , image=myimagepath)
add.pack()


Result:


this is the result of my code


Goal:


I want the image to be resized to a hight equal to the Entry widget.


How to add an image in javascript with document.getElementById

How do you make this have a result which is an image, not text



switch(true){
case (a>b):document.getElementById("result").innerHTML="hey";
break;

Upload image to page, image is saved onto the page for staff rota HTML/PHP/JScript

Would it be possible to have an image uploaded, this image then added to preferable to a gallery so admin can go see the images uploaded without previous being replaced by new uploads...


I have this which allows for the user to upload an image which then appears, but how would i make it so this image is then always there?



<style>
article, aside, figure, footer, header, hgroup,
menu, nav, section { display: block; }
</style>
</head>
<body>
<input type='file' onchange="readURL(this);" />
<img id="blah" src="#" alt="your image" />

<script>
function readURL(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();

reader.onload = function (e) {
$('#blah')
.attr('src', e.target.result)
.width(150)
.height(200);
};

reader.readAsDataURL(input.files[0]);
}
}
</script>


Any ideas? quite new to this! thanks


Taking photo intent with cropped image preview

I am making an application where I need to take a photo and then crop a 100x100 area from it. Right now I am making an intent call for taking a picture and then I create a CropActivity that will crop it.


I was wondering if default photo application could be set crop taken picture and show a border on screen to identify an area which is supposed to be cropped before taking the picture.


Maybe with some extras? I dont know. I search ong enought, but didnt find anything to do this in one step WITH preview.


(please do not post solutions, how to crop image separately and without a preview, I already know)


How to import many images instantly using javafx?

How do I upload over 500 images with large sizes in javafx? How to import many images instantly using javafx?



@Override
public void start(Stage primaryStage) {
primaryStage.setTitle("TaggingPaneView");

ScrollPane root = new ScrollPane();
root.setCacheHint(CacheHint.SPEED);

GridPane gridpane = new GridPane();
gridpane.setPadding(new Insets(5));
gridpane.setHgap(10);
gridpane.setVgap(10);
gridpane.setCacheHint(CacheHint.SPEED);

ImageView imv;
HBox pictureRegion = new HBox();
Image image;
int imageCol = 0;
int imageRow = 0;

for (int i = 0; i < 50; i++) {
image = new Image("image1.jpg");
imv = new ImageView();
imv.setImage(image);
imv.setCacheHint(CacheHint.SPEED);
imv.setImage(image);
imv.setFitWidth(100);
imv.setPreserveRatio(true);
imv.setSmooth(true);
imv.setCache(true);
imageCol++;


pictureRegion.getChildren().add(imv);
gridpane.add(imv, imageCol, imageRow);
if (imageCol > 5) {
// Reset Column
imageCol = 0;
// Next Row
imageRow++;

}
}
root.setContent(gridpane);
Scene scene = new Scene(root, 600, 330, Color.WHITE);


primaryStage.setScene(scene);
primaryStage.show();
}

Adding a Tint to PNG image in Flexslider with Wordpress

I am new to StackOverFlow (new to programming in general); I find myself in a stump regarding adding a tint to the image of the FlexSlider on front page. (which currently just have one post) I have looked at some related posts - taking some suggestions into consideration - to no avail. Could someone please assist with a suitable css code to add a tint (light brown) to my FlexSlider image?


site: curlyafrodotcom WP: 4.1.1 (current version) Theme: Dazzling (current version)


Thanks in advance, Candace


lodepng, stb_image. Nothing works in my system for image loading in C++

I'm trying to load pngs or bmps into my programs. But none of the libraries I found around the web works. I have no idea why but I always get "incorrect PNG signature, it's no PNG or corrupted" for EVERY png when using lodepng. "unknown pixel format" for EVERY bmp when using SDL_loadBMP. "unknown image type" for every png when using stb_image.


I can't load anything. Maybe there is something wrong with my system ? I'm using OSX Yosemite. Here is the code. #include #include #define STB_IMAGE_IMPLEMENTATION



#include <lodepng.h>
#include <stb_image.h>

using namespace std;

int main (){


string name = "res/img_test.png";
const char * cstr = name.c_str();

//lodepng
unsigned char *buffer;
unsigned int w,h;
int result = lodepng_decode32_file(&buffer, &w, &h, cstr);
cout << lodepng_error_text(result) << endl;


//stb_image
int x, y, comp;

FILE *f = fopen(cstr, "rb");
unsigned char *res;
res = stbi_load_from_file(f,&x,&y,&comp,0);
fclose(f);

cout << stbi_failure_reason() << endl;



return 0;
}


I'm using latest cmake to build this with gcc. Any recommendatation is appreciated but consider this. I've tried many files (generated by me or grabbed from internet). Tested same files with other users of the these libraries. Their code worked and mine didn't.


Thanks.


set intent's display size and position it if it is possible

I'm new to android so I appreciate all the comments you have.


I want to call a new Intent from a BroadcastReceiver. Is it possible to set the displayed size of the new intent and position it?


Precisely, I would like to place a custom picture on top of the incoming call screen and still be able to answer or reject the call.


I could do it with toast, but it disappears after I while and I don't want that to happen.


Thanks in advance!


Issue with paperclip-dropbox, not show images in records

I have web app, I connect it with paperclip-dropbox. Upload works good, but i can't open images on my app. When i try open image i get web address: http://ift.tt/1N2WSMh and issue: "It seems you don't belong here! You should probably sign in. Check out our Help Center and forums for help, or head back to home. "


model:



class Message < ActiveRecord::Base

has_attached_file :avatar, :styles => { :medium => "300x300>", :thumb => "150x150>" },
:storage => :dropbox,
:dropbox_credentials => Rails.root.join("config/dropbox.yml"),
:dropbox_visibility => 'public'

validates_attachment_content_type :avatar, :content_type => /\Aimage\/.*\Z/


validates_presence_of :topic, content: "- Dopisz"

end

Android, Image compression App

i have to create and submit an image compression app as a project, Just like they have in watsapp, so i searched a little and found out the code but when i use that in Android studio then lots of terms like "Bitmap" are shown to be not recognized. Can anyone tell how to paste the code and connect or relate that to my blank file in order to make that run, Here's the code,



public String compressImage(String imageUri) {

String filePath = getRealPathFromURI(imageUri);
Bitmap scaledBitmap = null;

BitmapFactory.Options options = new BitmapFactory.Options();

// by setting this field as true, the actual bitmap pixels are not loaded in the memory. Just the bounds are loaded. If
// you try the use the bitmap here, you will get null.
options.inJustDecodeBounds = true;
Bitmap bmp = BitmapFactory.decodeFile(filePath, options);

int actualHeight = options.outHeight;
int actualWidth = options.outWidth;

// max Height and width values of the compressed image is taken as 816x612

float maxHeight = 816.0f;
float maxWidth = 612.0f;
float imgRatio = actualWidth / actualHeight;
float maxRatio = maxWidth / maxHeight;

// width and height values are set maintaining the aspect ratio of the image

if (actualHeight > maxHeight || actualWidth > maxWidth) {
if (imgRatio < maxRatio) { imgRatio = maxHeight / actualHeight; actualWidth = (int) (imgRatio * actualWidth); actualHeight = (int) maxHeight; } else if (imgRatio > maxRatio) {
imgRatio = maxWidth / actualWidth;
actualHeight = (int) (imgRatio * actualHeight);
actualWidth = (int) maxWidth;
} else {
actualHeight = (int) maxHeight;
actualWidth = (int) maxWidth;

}
}

// setting inSampleSize value allows to load a scaled down version of the original image

options.inSampleSize = calculateInSampleSize(options, actualWidth, actualHeight);

// inJustDecodeBounds set to false to load the actual bitmap
options.inJustDecodeBounds = false;

// this options allow android to claim the bitmap memory if it runs low on memory
options.inPurgeable = true;
options.inInputShareable = true;
options.inTempStorage = new byte[16 * 1024];

try {
// load the bitmap from its path
bmp = BitmapFactory.decodeFile(filePath, options);
} catch (OutOfMemoryError exception) {
exception.printStackTrace();

}
try {
scaledBitmap = Bitmap.createBitmap(actualWidth, actualHeight,Bitmap.Config.ARGB_8888);
} catch (OutOfMemoryError exception) {
exception.printStackTrace();
}

float ratioX = actualWidth / (float) options.outWidth;
float ratioY = actualHeight / (float) options.outHeight;
float middleX = actualWidth / 2.0f;
float middleY = actualHeight / 2.0f;

Matrix scaleMatrix = new Matrix();
scaleMatrix.setScale(ratioX, ratioY, middleX, middleY);

Canvas canvas = new Canvas(scaledBitmap);
canvas.setMatrix(scaleMatrix);
canvas.drawBitmap(bmp, middleX - bmp.getWidth() / 2, middleY - bmp.getHeight() / 2, new Paint(Paint.FILTER_BITMAP_FLAG));

// check the rotation of the image and display it properly
ExifInterface exif;
try {
exif = new ExifInterface(filePath);

int orientation = exif.getAttributeInt(
ExifInterface.TAG_ORIENTATION, 0);
Log.d("EXIF", "Exif: " + orientation);
Matrix matrix = new Matrix();
if (orientation == 6) {
matrix.postRotate(90);
Log.d("EXIF", "Exif: " + orientation);
} else if (orientation == 3) {
matrix.postRotate(180);
Log.d("EXIF", "Exif: " + orientation);
} else if (orientation == 8) {
matrix.postRotate(270);
Log.d("EXIF", "Exif: " + orientation);
}
scaledBitmap = Bitmap.createBitmap(scaledBitmap, 0, 0,
scaledBitmap.getWidth(), scaledBitmap.getHeight(), matrix,
true);
} catch (IOException e) {
e.printStackTrace();
}

FileOutputStream out = null;
String filename = getFilename();
try {
out = new FileOutputStream(filename);

// write the compressed bitmap at the destination specified by filename.
scaledBitmap.compress(Bitmap.CompressFormat.JPEG, 80, out);

} catch (FileNotFoundException e) {
e.printStackTrace();
}

return filename;

}


And what i see in my blank file is,



package com.example.codyrichards.app_1;

import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;


public class activity_1 extends ActionBarActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_activity_1);
}
private static Bitmap codec(Bitmap src, Bitmap.CompressFormat format,
int quality) {
ByteArrayOutputStream os = new ByteArrayOutputStream();
src.compress(format, quality, os);

byte[] array = os.toByteArray();
return BitmapFactory.decodeByteArray(array, 0, array.length);
}

private static class SampleView extends View {

// CONSTRUCTOR
public SampleView(Context context) {
super(context);
setFocusable(true);

}
@Override
protected void onDraw(Canvas canvas) {
Paint paint = new Paint();

canvas.drawColor(Color.GRAY);

// you need to insert some image flower_blue into res/drawable folder
Bitmap b = BitmapFactory.decodeResource(getResources(), R.drawable.flower_blue);
// Best of quality is 80 and more, 3 is very low quality of image
Bitmap bJPGcompress = codec(b, Bitmap.CompressFormat.JPEG, 3);
// get dimension of bitmap getHeight() getWidth()
int h = b.getHeight();

canvas.drawBitmap(b, 10,10, paint);
canvas.drawBitmap(bJPGcompress, 10,10 + h + 10, paint);

}
}
}


@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_activity_1, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();

//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}

return super.onOptionsItemSelected(item);
}
}

c# - inserting smileys in RichTextBox inserts some and ignores others

I have a code to replace symbols in the richtextbox to smileys, this is the code:



private void add_smileys(RichTextBox addin)
{
try
{
while (addin.Text.Contains(":)"))
{
addin.SelectionStart = addin.Find(":)", RichTextBoxFinds.WholeWord);
addin.SelectionLength = 2;

Image img = Resources.in_smile;
Clipboard.SetImage(img);
addin.Paste();
}
while (addin.Text.Contains(">:("))
{
addin.SelectionStart = addin.Find(">:(", RichTextBoxFinds.WholeWord);
addin.SelectionLength = 3;

Image img = Resources.in_angry;
Clipboard.SetImage(img);
addin.Paste();
}
while (addin.Text.Contains(":D"))
{
addin.SelectionStart = addin.Find(":D", RichTextBoxFinds.WholeWord);
addin.SelectionLength = 2;

Image img = Resources.in_lol;
Clipboard.SetImage(img);
addin.Paste();
}
while (addin.Text.Contains(":'("))
{
addin.SelectionStart = addin.Find(":'(", RichTextBoxFinds.WholeWord);
addin.SelectionLength = 3;

Image img = Resources.in_cry;
Clipboard.SetImage(img);
addin.Paste();
}
while (addin.Text.Contains(":("))
{
addin.SelectionStart = addin.Find(":(", RichTextBoxFinds.WholeWord);
addin.SelectionLength = 2;

Image img = Resources.in_sad;
Clipboard.SetImage(img);
addin.Paste();
}
while (addin.Text.Contains(";)"))
{
addin.SelectionStart = addin.Find(";)", RichTextBoxFinds.WholeWord);
addin.SelectionLength = 2;

Image img = Resources.in_wink;
Clipboard.SetImage(img);
addin.Paste();
}
while (addin.Text.Contains("xD"))
{
addin.SelectionStart = addin.Find("xD", RichTextBoxFinds.WholeWord);
addin.SelectionLength = 2;

Image img = Resources.in_laugh;
Clipboard.SetImage(img);
addin.Paste();
}
while (addin.Text.Contains(":P"))
{
addin.SelectionStart = addin.Find(":P", RichTextBoxFinds.WholeWord);
addin.SelectionLength = 2;

Image img = Resources.in_tongue;
Clipboard.SetImage(img);
addin.Paste();
}
while (addin.Text.Contains(":|"))
{
addin.SelectionStart = addin.Find(":|", RichTextBoxFinds.WholeWord);
addin.SelectionLength = 2;

Image img = Resources.in_neutral;
Clipboard.SetImage(img);
addin.Paste();
}
while (addin.Text.Contains("^^"))
{
addin.SelectionStart = addin.Find("^^", RichTextBoxFinds.WholeWord);
addin.SelectionLength = 2;

Image img = Resources.in_happy;
Clipboard.SetImage(img);
addin.Paste();
}
while (addin.Text.Contains("o.O"))
{
addin.SelectionStart = addin.Find("o.O", RichTextBoxFinds.WholeWord);
addin.SelectionLength = 3;

Image img = Resources.in_dizzy;
Clipboard.SetImage(img);
addin.Paste();
}
while (addin.Text.Contains(":S"))
{
addin.SelectionStart = addin.Find(":S", RichTextBoxFinds.WholeWord);
addin.SelectionLength = 2;

Image img = Resources.in_confused;
Clipboard.SetImage(img);
addin.Paste();
}
while (addin.Text.Contains(":O"))
{
addin.SelectionStart = addin.Find(":O", RichTextBoxFinds.WholeWord);
addin.SelectionLength = 2;

Image img = Resources.in_omg;
Clipboard.SetImage(img);
addin.Paste();
}
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
}


and this is the output: enter image description here


as you see, some symbols are replaced with smileys and some aren't. moreover, I get this exception: enter image description here


What is the cause of this error? and how do I fix it? please be friendy and don't be mean. and don't be mean and don't downvote my Question, as I have been desparate about it for more than a week, please help me if you know the answer and don't ignore it.


Resizable image in JTextPane

I want to my JTextPane be able to resize pictures by drag and drop. Like in this article: http://ift.tt/1EzIffT


I’m able to implement it exactly like in this article with simply inserting panel into the JTextPane and insert image into this panel. It works, but it is useless for me, because I'm using AdvancedRTFEditorKit for writing document into the file. This approach disrupt Document and therefor EditorKit is not able to save images into the file.


Is there some way to implement this function without disrupted Document? Just somehow change the IconView of EditorKit?


I’m so far that my editor is able to showing hand cursor, if cursor is above the image. (Exactly like in this article: Detecting image on current mouse position only works on part of image)


I’m able to catch mouseClicked event on image by using same approach, but I really don’t know, how can I get instant of IconView to paint borders on image.


Like this:


enter image description here


Or is there another way, how to do that? I will really appreciate any idea.


Can't control my nav list's vertical position

I got a "navbar" in a nav wrapper, where I have 4 "links" and an image in the middle.


http://ift.tt/1LWuw4Q


The wrapper ends where the white line is drawn.


However... I can't manage to control the position for my links, vertically, since the image seems to push the link bar to the bottom.


I've tried with padding/margin, top/bottom, and only on the link items, but there is no way I can find how to move it up. (I want the links centered vertically on the image. Two links on each side.) Now they are at the bottom as you can see.


I guess you can easily see my code by looking at it in chrome/firefox etc...


Really appreciate any advice. I've tried to move the image itself as well, but it always end up pushing the links down.


TowerDefense image import (eclipse,java)

I've been working on a tower defense game using eclipse and I cannot manage to print out the picture of my tower. Here is some code from the main tower class :




`public class MainTower {
public String TextureFile = "";
public Image texture;

public static final MainTower[] towerList = new MainTower[150];

public static final MainTower towerOfLight = new LightningTower(0).getTextureFile("Lightning");
public MainTower(int id) {
if(towerList[id] != null){
System.out.println("[Tower Initialization] Two towers with the same id" + id);

else{
towerList[id] = this;
this.id = id;
}
}
public MainTower getTextureFile(String str) {
this.TextureFile = str;
this.texture = new ImageIcon("/res/tower/" + this.TextureFile + "png").getImage();
return null;
} }


The location is correct the image is a 25x25 png image called Lightning. Here is some code from the layout class :



> `for(int x = 0; x<15; x++){
> for(int y = 0; y<2; y++){
> if(MainTower.towerList[x *2 +y] != null) GUI.drawImage(MainTower.towerList[x * 2 + y].texture, (int) (12 + 12 + 250 + 40 + 12 +(x * towerWidth)), (12*50) + 20 + (y *(int)towerHeight), null);
>
> GUI.drawRect((int) (12 + 12 + 250 + 40 + 12 +(x * towerWidth)), (int) ((12*50) + 20 + ((y * towerHeight))),(int)towerWidth,(int)towerHeight);
> }
> }
> }`


I've created a grid (boxes) at the bottom of the screen where I wish to place my towers so the player can choose. So I was wondering where am i going wrong so the picture doesn't print out.


Automatically resize images in grid to fit screen width - remove right side white space

I'm creating an image grid in a wordpress page to display posts as thumbnails in a grid. I already have them displayed in a grid but every option I have tried creates excess whitespace in the right side. The images are moved to the next line rather than resize to fit the width.


This is the grid on my index page:



<div id="grid">
<div class="container-fluid">
<div class="row">
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<a href ="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php echo get_the_post_thumbnail( $thumbnail->ID, 'large' ); ?></a>
<?php endwhile; else : ?>
<p><?php _e( 'Sorry, no posts matched your criteria.' ); ?></p>
<?php endif; wp_reset_query(); ?>
</div>
</div>
</div>


The only specific CSS I used is 5px of padding on the images.



.attachment-large {
padding: 5px !important;
}


I have set my large thumbnail sizes to max-width: 400 and max-height: 230. This makes all images equal in height but still leaves the white space to the right in the columns.


I have installed and activated jQuery Masonry Image Gallery plugin. It provides the grid but still leaves the space. I tried with another Masonry plugin but it did the same thing.


Do you know how to get rid of the space?


Adding an Image to a Canvas Using AskOpenFileName

I'm trying to get a .gif image to go into a canvas after selected from my PC using filedialog.askopenfilename(). The canvas will take the image if I (1) don't put it in a def and (2) do not use the filedialog, but I can't see why this would not work ....



from tkinter import *
root=Tk()
root.geometry("600x600")
root.config(background="#FFFFFF")

canvas = Canvas(width=200,height=200)
canvas.grid(row=0,column=0)


def create_image():
profileimage = filedialog.askopenfilename()
i = PhotoImage(file=profileimage)
canvas.create_image(0,0,image=i)

b = Button(text="Click", command=create_image).grid(row=1,column=0)

Display product images in a datagrid in 4 columns and X rows (VB.NET)

Hello I am building a POS system and would like to display a list of images all available products for selection.


So for example, if someone picks category: Shirts, a datagrid of images all Shirts in that category should appear.


The grid should show in a 4 by X matrix where X is the number of columns (dependant on the number of products obviously).


So the result should look something like this link (with only the pictures showing and no writing to keep it simple).


Any Ideas at all please? Not expecting code, just some guidance on how to kick this off.


Print html table with a background image

I want to print the contents of my html table (with headings, cell spacing, cell padding, border, etc.) with a background image. Also the print should contain page no.s at its footer. Can anyone help me out with that??


Table is generated using php while loop, from mysql database.


Adobe LiveCycle ES4 Image to PDF converter Java API

I didn't find Java API to convert Image to PDF format using Adobe Live Cycle Server ES4.


They have provided sample code for how to convert PS to PDF. but I need to convert Image to PDF using Java API.


It will be helpful if someone provides the sample code for this.


Thanks, Sithik


Merge two Mat-Objects in OpenCV

I wrote a little function in order to be able to "stick" the pixels of an image on top of another, but it somehow doesnt work: While the "shapes" of my "sticked" image is right, the colors are not. enter image description here


The example flower is the first image, and as a second image I had a black trapezoid png. As you can see, there are multiple problems: 1. The colors are shown weirdly. Actually there are no colors, just greyscale, and some weird stripes as overlay. 2. Alpha values are not respected. The white part of the overlay image is transparent in the png.


Here is my code:



void mergeMats(Mat mat1, Mat mat2, int x, int y){
//unsigned char * pixelPtr = (unsigned char *)mat2.data;
//unsigned char * pixelPtr2 = (unsigned char *)mat1.data;
//int cn = mat2.channels();
//int cn2 = mat2.channels();
//Scalar_<unsigned char> bgrPixel;

for (int i = 0; i < mat2.cols; i++){
for (int j = 0; j < mat2.rows; j++){
if (x + i < mat1.cols && y + j < mat1.rows){

Vec3b &intensity = mat1.at<Vec3b>(j+y, i+x);
Vec3b intensity2 = mat2.at<Vec3b>(j, i);
for (int k = 0; k < mat1.channels(); k++) {
intensity.val[k] = saturate_cast<uchar>(intensity2.val[k]);
}
//pixelPtr2[(i + x)*mat1.cols*cn2 + (j + y)*cn2 + 0] = pixelPtr[(i + x)*mat2.cols*cn + (j + y)*cn + 0];
//pixelPtr2[(i + x)*mat1.cols*cn2 + (j + y)*cn2 + 1] = pixelPtr[(i + x)*mat2.cols*cn + (j + y)*cn + 1];
//pixelPtr2[(i + x)*mat1.cols*cn2 + (j + y)*cn2 + 2] = pixelPtr[(i + x)*mat2.cols*cn + (j + y)*cn + 2];
}
}
}
}


The commented code was another approach, but had the same results. So, here are my questions: 1. How do I solve the 2 problems (1. the colors..., 2. alpha ...) 2. How is the pixel-array of any Mat-Object actually, well, organized? I guess it would be easier for me to manipulate those arrays if I knew whats in them.


String to Image convertion in php and store in mysql database

I want to store an image(which is passed by an android developer) into mysql database. I'm working in PHP. Plz help me someone to script php code.


Actualy I asked half question. Main problem area is that how to store image in upload folder?


On woocommerce how do I remove this cropping to product catergory thumbnails?

I've searched and tried fixing this myself for several hours, however, I cannot find a proper solution.


The images I upload to Woocommerce's product category are getting cropped to a 1:1 aspect ratio, and I want them to stay at the original dimensions and aspect ratio that I uploaded them at.


the main part of the snippet I am confused with is that there is an added -150x150.png at the end of my img src. How in the world do I remove that? I could not find it anywhere in any of the woocommerce php files. I'm assuming this is being added when the thumbnail is uploaded?


The code that the php creates to display the image looks like this:



<a href="http://localhost/radioactivewonderland/?product_cat=phone-charms">

<img src="http://localhost/radioactivewonderland/wp-content/uploads/2015/02/cghjnfgchjn-150x150.png" alt="Phone Charms" height="" width="Phone Charms" />




<h3> Phone Charms <mark class="count">(1)</mark> </h3>


</a>

Auto-adjust image height depending on textbox

I'm looking for a way to auto adjust an image's height depending on a textboxs size. The textbox will change in height the browser window's size (


first, the image should match the height of the textbox first, the image should match the height of the textbox


As the window is resized the picture's height is adjusted As the window is resized the picture's height is adjusted


This is my html and css-code so far:


INDEX.HTML



<div class="wrapper">
<img id="about" src="images/about.jpg">
<div class="textbox">
Lorem ipsum dolor sit amet....
</div>
</div>


MAIN.CSS



.wrapper {
}

#about {
float:right;
padding-left: 25px;
}

.textbox {
width: 50%;
}

image re-sizing based on image content height

I wanted to resize an image based on image content size. For example I have an image of 120*160 pixel that contains peoples, I want to resize the image like the people inside the image will have a height of 50 pixel and so on.


Anyone have any idea for this?


Thanks in advance.


HTML img tag does not render source image in WebKit.NET browser in C#

I'm trying to set my WebKitBrowser DocumentText to an HTML string containing a local SVG file path as image source. Actually I want to show the SVG file in a web browser. Here is my code:



string SVGPath = "file:///D:/MySVGFiles 1/SVGSample01.svg";

StringWriter stringWriter = new StringWriter();

using (HtmlTextWriter writer = new HtmlTextWriter(stringWriter))
{
writer.AddAttribute(HtmlTextWriterAttribute.Src, SVGPath);
writer.AddAttribute(HtmlTextWriterAttribute.Width, "50%");
writer.AddAttribute(HtmlTextWriterAttribute.Height, "50%");

writer.RenderBeginTag(HtmlTextWriterTag.Img);
writer.RenderEndTag();

}

string content = stringWriter.ToString();

this.webKitBrowser1.DocumentText = content;


When I run the code, the browser only shows the image canvas, and does not render the SVG file. I have tried this with a JPG image too, and got the same result.


Could anyone please tell what is wrong with this code??


Copy image file in a path to SQL Server (using Asp.net, vb.net)

I am very new to asp.net programming. I Have an excel workbook containing locations of image files for e.g. "C:\Users\Suresh\Desktop\DWG\images (0).jpg" in column C (there are more than 50 image paths in column C). I am looking for a method to copy these image files from the above path and store in sql server database.


Please help me to solve this.


Thanks in advance, Suresh.


Django Imagefield url does not contain MEDIA_ROOT

I have a model with a ImageField and created an simple Upload Form via CreateForm. I have a simple ListView to show the images (logos).


Upload works fine, Iterating the logos works. Property logo.url is missing but instead it is logo.media. Unfortunately media does not contain the whole path, MEDIA_ROOT is missing. What am I doing wrong here?


models.py:



class Logo(models.Model):
media = models.ImageField(upload_to='uploads')


views.py:



class LogoManager(CreateView):
model = Logo
template_name = 'polls/upload.html'
success_url = '/logos/'

class LogoIndex(ListView):
model = Logo
template_name = 'polls/logos.html'


upload.html:



{% block title %} Upload Form {% endblock %}
{% block content %}

<form id="my_form" action="" method="post" enctype="multipart/form-data">{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="Save Changes" />
</form>
<br />
<a href="{% url 'polls:index' %}">Back</a>
{% endblock %}


logos.html:



{% block content %}
{% if object_list %}
<ul>
{% for image in object_list %}
<li><img src="{{ image.media }}" width="320" height="200"/></li>
{% endfor %}
</ul>
{% else %}
<p>No Logos are available.</p>
{% endif %}
<br />
{% endblock %}


Output is:



<li><img src="uploads/IMG_5106.JPG" width="320" height="200"/></li>

Displaying a PHP variable from Database along with HTML

I want to display a row that contains a text and an image saved with a PHP Variable from a database.

Exemple:



Row contains: "Some text about something and then <img src="images/$img">"



When i try to echo it's displaying like a plain text

Exemple:



"Some text about something and then <img src="images/$img">" thus the $img = "test.png" and image should be echo like <img src="images/test.png">



How to search images on Google using Goggle Custom Search?

How to search images on Google site using Goggle Custom Search? I read that their Image Search API is now deprecated. And there aren't any examples with GCS.


For example I want to search images "play station 4" and add filter: show only large images.


How to do it?


I want to make a small PC application on C++/Qt and do http requests to extract images from reply.


vendredi 27 février 2015

How can I save only a part of an image with Dynamic Web TWAIN?

I would like to save only a part of an image scanned with Dynamic Web TWAIN...I am not looking for a crop, because the crop will change the image itself. How can I do it? Thanks.


Img not showing in Safari, does show in Chrome

I feel like I'm missing something here. I've got a website for a client where the images show up perfect in Chrome and just fail to appear entirely in Safari. I'm using only HTML and CSS. Any ideas? The live site is at angelahartley.net


HTML:



<ul class="gallery">
<li><img src="img/home1.jpg" title="newborn greta: by Josh Muir" alt="newborn greta in arms"></li>
<li><img src="img/home2.jpg" title="newborn greta: by Josh Muir" alt="baby greta on a rainbow"></li>
<li><img src="img/home3.jpg" title="photo by Santa Cruz Birth Photography" alt="baby, mom, and dad in birthing pool"></li>
</ul>


CSS:



.gallery {
width: 100%;
margin: 0 auto;
padding: 0;
list-style: none;
background-color: #947960;
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-box;
display: flex;
flex-wrap: nowrap;
justify-content: space-around;
align-items: center;
}
.gallery li {
float: left;
width: 33.33333333%;
margin: 4px .5% 1px .5%;
padding: 0 ;

}
img {
max-width: 100%;
border: 1px solid #00565E;
border-radius: 2.5%;
}

HTML loaded image goes away after refresh

So this is a weird phenomenon I've never experienced in that I have an HTML form on image upload (exactly the one on W3). It does it's job properly when clicked and pushes the user profile picture into a folder while saving the name of the file on a database. Underneath the upload, I have a little image tag that spits out the uploaded profile picture. The end goal is for that profile picture to be displayed on the page constantly while the session exists. When uploaded, it works perfectly fine and the profile picture appears. After one refresh, the image can't be found and the alt="blank" takes over. The location still stays proper in the database so I don't think that's the issue. Is there an error? Do I need to use JS onload? Does the image tag only work once? Please help and thank you for taking the time to read this.


PHP:



echo '<img src="'.$loaded_profile_picture.'"id="HOMEPROFILE" alt="blank" style="width:128px;height:128px">';
//$loaded_profile_picture has the value uploads/photo.jpg


Classes.php:



public function addProfilePicture(){
include_once "conn.php";
$sql=$dbh->prepare("UPDATE users SET UserProfilePicture=:UserProfilePicture WHERE UserName=:UserName;");
$sql->execute(array(
'UserProfilePicture'=>$this->getUserProfilePicture(),
'UserName'=>$_SESSION['UserName'],
));
}


Image Upload (Might be the culprit):



if($uploadsuccess&&move_uploaded_file($_FILES['fileToUpload']['tmp_name'], $target_file)){
echo " The file ".basename($_FILES['fileToUpload']['name'])." has been uploaded.";
$user->setUserProfilePicture($target_file);
$user->addProfilePicture();
if($user->getUserProfilePicture()!=NULL){
echo '<img src="'.$target_file. '" alt="nom">';
}
}

PHP uploading images with different thumbnail size

i have searched the net for quite so long, but i have seen that there are uploading images that are capable of the task, but i was wondering, if there's a way that i could upload an image then automatically converts the image uploaded in different thumbnail sizes, like 50x50, 150x150, 250x250.


Thanks in Advance.


Can EXIF image data be displayed on page using JSSOR?

Can JSSOR slider extract EXIF data from an image to be displayed on webpage? More specifically, can the "title" of the image be extracted to be displayed under the the image?


This would be useful if you are dealing with hundreds or thousands of images, rather than adding an individualized additional tag per image.


Thank you


Uploading image files and php not registering any inputs

I have a fairly simple HTML form with a file input and I'm trying to post it to a block of PHP code.


I use this same method in other places on my website and it works perfectly, there must be some very basic (probably embarrassing) thing I'm overlooking.


HTML & PHP:



<?php

echo 'It reads to this point';

if(empty($_FILES['aca']))
print_r("Damn");
if(isset($_FILES['aca']) === true)
{
echo 'something';
if(empty($_FILES['aca']['name']) === true)
{
echo 'Please choose a file! <br>';
}
else
{

$allowed = array('jpg', 'jpeg', 'gif', 'png');

$file_name = $_FILES['aca']['name'];

$file_extn = strtolower(end(explode('.', $file_name)));
$file_temp = $_FILES['aca']['tmp_name'];
echo '<br>';
echo '<br>';
print_r($_FILES['aca']['tmp_name']);
echo '<br>';
echo '<br>';
if(in_array($file_extn, $allowed) === true) {

upload_image($file_temp,$file_extn);

echo 'You have uploaded a picture!';
echo '<b><h3>Press submit again to finish the upload</h3></b>';
//echo "<script>window.top.location='../hidden/viewPNM.php?id=$permi'</script>";


}
else
{
echo 'Incorrect File Type!! <br> Allowed: ';
echo implode(', ', $allowed);

}

}

}


?>
<form action="" method="post" id="aca" enctype="multipart/form-data">
<input type="file" id="aca" name="aca"> <input type="submit">
</form>

Problems rendering large html files (links are wrong, images not displaying)

I created a script which takes an xml input and creates html based reports for ease of viewing. All of the reports are based off of the same html template. Some reports are small (50KB), some are larger (7MB). I have a problem with the larger page not rendering images and links pointing to the wrong places. What is odd is that if I remove the large data blocks (just a series of divs), things render fine. Also, things are fine if the reports are smaller to begin with.


For example, with a small report, the following code renders the img correctly:



<a href="http://www.company.com"><img id="logo" src="../images/logo.png" alt="logo" /></a>


The exact same code gives me a missing image icon in a larger report. When inspecting the element in Firefox, I get "Could not load the image" message. Again, all reports are based off the same html template, and the code for the logo and nav never change, neither does the directory structure.


Additionally, the following code is a simple link to return to the main page:



<nav id="nav">
<a href="../index.html">Dashboard</a>
</nav>


The link works properly in a smaller page, but in a larger one it tries to redirect to file:///user/index.html (wrong).


I have tried moving the large file into a different directory, tried moving it to the parent directory and redoing the links, but nothing helps. While first loading the page, it displays the alt text, then the broken image icon.


This happens in Chrome, Firefox, and IE11. The image displays properly in Safari. The only thing that seems to have an impact is the size of the file.


Any ideas would be greatly appreciated as all my Google-fu has been spent.


MFC Picture Control does not get/forward mouseDown/mouseUp/MouseMove messages

I have title-less MFC Dialog. So it does not move if you drag it and you need to take care movements yourself. I do this like this:



bool mbMousedown;
void MyDialog::OnLButtonDown(UINT nFlags, CPoint point)
{
mbMousedown = true;
CDialogEx::OnLButtonDown(nFlags, point);
}
void MyDialog::OnLButtonUp(UINT nFlags, CPoint point)
{
mbMousedown = false;
CDialogEx::OnLButtonUp(nFlags, point);
}

afx_msg LRESULT MyDialog::OnNcHitTest(CPoint point)
{
CRect r;
GetClientRect(&r);
ClientToScreen(&r);
if (r.PtInRect(point))
{
if (mbMousedown)
{
return HTCAPTION;
}
}
return CDialogEx::OnNcHitTest(point);
}


It works - when i drag the dialog it moves. But when i place picture control on the dialog (yes i set notify to true) then the picture control forward only click messages to the dialog but not mousedown/mouseup/mousemove. It just does not have these handlers in class wizard. So if user press the image inside the picture control and drag the dialog like this then nothing happens since dialog did not get any messages from the picture control.


I know i can solve this using activeX picturebox - i do not want to add activeX. I know i can derive from picture box and do that - but really there is no easiest solution than that to get picturebox to pass the notification or to make my dialog to move when user drag it with the picture control ? I have many pictures controls on the dialog - with images ...


Images within divs are being cut off due to height differences, how to display them entirely?

My site consists of 3 divs (blueish boxes) lined in a row. Each div contains an image and either 3 or 4 lines of text, which each residing within a p tag


The problem is that the images are not being shown entirely within the divs. Instead the sides are being cut off and this obscures the image. In the following demo you can see the divs containing cut-off images, and then the full-size images below them for reference. Demo here


Please note that the images are different heights, yet they do not disrupt the even alignment of the lines across each div as shown below. I'd like this feature to remain:


Screeny1


How do I make the images display entirely within the div (including feathering effect)? I've created a mockup below of the ideal solution:


enter image description here


The code for the first div is:



<a href="htada">
<p class="vignette" style="background-image:url(http://ift.tt/1AT5qz2)"></p>
<p class="redbox">&nbsp;</p>
<p class="titlebox">Demo</p>
<p class="locationbox">Demo</p>
<p class="pricebox">Demo</p>
<!-- END OF SINGLE LISTING -->
</a>


and it's CSS:



.mainbox a {
display: inline-block;
vertical-align: top;
margin: 0 0.5em 0;
width: 28%;
background: #E7E6F2;
box-shadow: 0 50px 0 #E7E6F2 , 0 100px #E7E6F2 , 0 150px #E7E6F2;
border-top: 1em solid white;
padding: 0.5em;
margin-top: 151px;
height: 700px;
}


You can see the image is produced using a div with style of background-image:url(http:// ... and that div's CSS is:



.vignette {
width: 90%;
margin-left:auto;
margin-right:auto;
margin-bottom:1%;
margin-top: 4%;
box-shadow: 15px 15px 40px #E7E6F2 inset,-15px -15px 40px #E7E6F2 inset;
height: 290px;
background-size: cover;
background-repeat: no-repeat;
}


Thanks for your help!


Get status of an ongoing docker image pull

How to get status of a running docker pull process? I tried pulling busybox with sudo docker pull busybox . But no status is being displayed. On issuing another pull request after a ctrl+c it says that image is already being pulled by another client.Also I tried cancelling the ongoing pull and I couldnt here is a bug report regarding the issue.



$sudo docker pull busybox
Repository busybox already being pulled by another client. Waiting.


How can I display the progress of an ongoing docker pull?


javascript display multiple images

Just to let you know I am a complete newbie, I have a html page that shows different images combined. I am using javascript to select images to display. Here's my code:



<head>
<script type="text/javascript">
var num1 = Math.ceil( Math.random() * 6 );
var num2 = Math.ceil( Math.random() * 6 );
var num3 = Math.ceil( Math.random() * 6 );
var num4 = Math.ceil( Math.random() * 6 );
var num5 = Math.ceil( Math.random() * 4 );
var imgpath1 = "<img src=" + '"' ;
var imgpath2= "./Nums24-38/Nums" + num5 + "_";
var imgpath3= ".png" + '"' ;
var imgpathA = imgpath1 + imgpath2 + num1 + imgpath3 ;
var imgpathB = imgpath1 + imgpath2 + num2 + imgpath3 ;
var imgpathC = imgpath1 + imgpath2 + num3 + imgpath3 ;
var imgpathD = imgpath1 + imgpath2 + num4 + imgpath3 ;
var imgpathE = imgpathA + imgpathB + imgpathC + imgpathD ;
</script>
</head>
<body>

<h1>Hello </h1>
<h2>Welcome to Home-brewed Captcha </h2>

My Random number is <script>document.write(num1); document.write(num2); document.write(num3);document.write(num4)</script>

<p> My path is <script>document.write(imgpath2); document.write(num1); document.write(imgpath3) </script></p>

<p>First Java Image is <script>document.write(imgpathA) </script> </p>

<p>Second Java Image is <script>document.write(imgpathB) </script> </p>

<p>Third Java Image is <script>document.write(imgpathC) </script> </p>

<p>Fourth Java Image is <script>document.write(imgpathD) </script> </p>


<p> Merged Java Image ABCD is
<script> document.write(imgpathA) </script>
<script> document.write(imgpathB) </script>
<script> document.write(imgpathC) </script>
<script> document.write(imgpathD) </script>
</p>


<p> New merged Java image A+B+C+D is<script>document.write(imgpathE) </script> </p>

<h3>Another merge , this time bypassing java <img src="./Nums24-38/Nums3_3.png"><img src="./Nums24-38/Nums3_1.png"><img src="./Nums24-38/Nums3_0.png"><img src="./Nums24-38/Nums3_6.png"></h3>
</body>


You can see a live demo at http://ift.tt/1Bosdo7 Why does all images dont show up. Where am I going wrong. Muja


Concatenate/Append png images into single Document (any format)

I have a routine to generate png images from a form (1 to 35 image). I need to append a variable number of this images for printing.Maybe appending on a single pdf or any kind of document, the goal is to automate printing. I can figure out how to print one by one, but i need to use a A4 page (4 images per page). Do you know anything about this, i have been trying with PdfSharp but i cant't figure out how to do this.


Any suggestion, link or code is welcome.


Thank you. Best regards Diego Porras


Can emacs show an image in a zip archieve file in org-mode

In emacs org-mode with iimage-mode enabled, it can show an inline image from a relative file path, like: [[file:images/foo.jpg]]


What I want is: how can it shows an image locates in an zip archive, like this: [[file:images.zip/foo.jpg]] Is there a way to do this?


responsive images resizing based on css classes

I want to resize images basing on media queries. If this was just an image, I would attach a CSS class to the image and override it for different screen resolutions.


The thing is that the images are, actually, fontawesome icons. This is an example: http://ift.tt/1g7oLUF



<i class="fa fa-camera-retro fa-lg"></i> fa-lg
<i class="fa fa-camera-retro fa-2x"></i> fa-2x
<i class="fa fa-camera-retro fa-3x"></i> fa-3x
<i class="fa fa-camera-retro fa-4x"></i> fa-4x
<i class="fa fa-camera-retro fa-5x"></i> fa-5x


fa-lg, fa-2x, fa-3x, etc. are CSS classes that apply different sizes. What is the best approach to do responsive approach here - change icon sizes depending on screen size? I don't want to modify the 3rd party lib (font awesome) itself. It seems like changing screen resolution should replace one class with another...


Create/generate image URL from base64 string

I have a mobile based application that uses REST based service to upload images. The images are stored/retrieved in database as blob. Clearly so, now we have space and performance overheads, which is not working.


What needs to be implemented now, is a file system for image hosting. My web application is hosted on Google app engine, creating a file system and storing the files url in database, would require me to purchase extra storage space.


I have heard about free image hosting services online? Having never used any of them before, I need to know about any popular/reliable image sharing services online? Also, the ones that expose their services to my web application, and return a generated url in response. Which would ofcourse be stored in my database, in place of the string. Any suggestions would be much appreciated.


How do I display an embedded image from an object in an aspx page?

I have an object with an embedded image accessible as a property e.g. myObject.image. This image is a Gif that is stored as an embedded resource in the dll. On my aspx source I have a .net image control. This control essentially spits out a standard html image element that needs an image url as a source. So how do I make this thing display my image property from my object? I can't simply say myHTMLImageElement = myObject.image.


Thank you for your time.


Capture table excel as image

I try to rescue a table (MxN) from excel document, through the capture of picture about this and then save in the MATLAB folder. How is it possible to do this? Are there any routine to do this? Any help will be welcome.


Display picture in gridview column c#

I have a bounded griview1 and I add it a Column as repositoryItemImageEdit1


Im trying to display a picture with the path string



DevExpress.XtraGrid.Views.Card.CardView view = sender as DevExpress.XtraGrid.Views.Card.CardView;


Image img= Image.FromFile("\\path"); view.SetRowCellValue(rowindex, view.Columns["photo"], img);

capture image RelativeLayout , unfortunately , app has stopped

When using capture image RelativeLayout , unfortunately , app has stopped. I have 20 ImageView in RelativeLayout.**


Storing bitmap into sql

I'm coding an app for printing bills. I have a form within I load data. I want to automate printing, so in that order i save a bmp image of my filled form and then store into a mdf database for late print each row/cell (images in this case). But when i drag my table into a preview form (just for chek if i store data correctly) the id of each row appears, but i can't see that row's image... the question is: what am i doing wrong here? (i watched a lot o tutorials for last 3 days but i can't figure out yet what to do)



Public Sub toBitMap()
'Define un nuevo bitmap con las dimensiones del form
Dim miBitMap As New Bitmap(imprimir.Width, imprimir.Height)
' Dibuja la imagen del form en un objetoBitmap
imprimir.DrawToBitmap(miBitMap, New Rectangle(0, 0, imprimir.Width, imprimir.Height))
Dim memoryStreamBuffer = New MemoryStream()
miBitMap.Save(memoryStreamBuffer, ImageFormat.Bmp)
Dim data As Byte() = memoryStreamBuffer.GetBuffer()
Dim saveImage As imagenesTableAdapter = New imagenesTableAdapter
Dim a As String = saveImage.insertImagen(data)
If multiple.iteraciones <= 0 Then
cantidad = saveImage.ScalarQuery()
End If
End Sub

Converting a BitmapImage byte array to an Image byte array (WinRT -> WinForms)

I have 2 solutions in this project. A windows forms solution and a Windows 8.1 Tablet project. This is what's supposed to happen:



  1. User takes a picture using the tablet and uploads it to a MySQL database in the form of a byte array.

  2. User starts up the windows forms application and loads the byte array from the MySQL database.

  3. It then converts the byte array to an image which is placed in a picturebox.


I'm storing the byte array like this:



CameraCaptureUI dialog = new CameraCaptureUI();
dialog.PhotoSettings.Format = CameraCaptureUIPhotoFormat.Jpeg;
Size aspectRatio = new Size(16, 9);
dialog.PhotoSettings.CroppedAspectRatio = aspectRatio;

StorageFile file = await dialog.CaptureFileAsync(CameraCaptureUIMode.Photo);
if (file != null)
{
BitmapImage bitmapImage = new BitmapImage();
using (IRandomAccessStream fileStream = await file.OpenAsync(FileAccessMode.Read))
{
var readStream = fileStream.AsStreamForRead();
byte[] pixeBuffer = new byte[readStream.Length];
await readStream.ReadAsync(pixeBuffer, 0, pixeBuffer.Length);

}


The byte array is successfully stored in my database.


I'm running into a problem when converting the byte array into a WinForms Image. This is my code:



using (var ms = new MemoryStream(bytes))
{
Image i = Image.FromStream(ms);
return i;
}


This gives me an invalid parameter exception.


I'm guessing it's something with the image format? I'm really new to streams though so I have no idea.


Any help is welcome!


PS: I know storing in the SQL database runs perfectly since I can store and load images perfectly using the WinForms application only.


CSS fading image gallery not working properly

I am trying to create an image gallery which works by having four images stacked and one fading away every eight seconds, i had it working with two images and have been trying to make it work with four using animation-delay although this does not seem to be working properly. Here is the CSS:



#cf {
position: relative;
height: 100%;
width: 100%;
margin: 0 auto;
}

#cf img {
position:absolute;
left:0;
width: 100%;
height: 100%;
-webkit-transition: opacity 1s ease-in-out;
-webkit-animation: cFade 32s ease-in-out infinite normal;
}

@-webkit-keyframes cFade {
0% {
opacity:1;
}

21.875% {
opacity:0;
}

25% {
opacity:0;
}
68% {
opacity:0;
}
100% {
opacity:1;
}
}

#cf img.first {
-webkit-animation-delay: 0s;
}
#cf img.second {
-webkit-animation-delay: 8s;
}

#cf img.third {
-webkit-animation-delay: 16s;
}

#cf img.fourth {
-webkit-animation-delay: 24s;
}

How to handle massive image marking/tagging?

I'm currently working on a web app where the user interaction is mainly based on images and what is marked on it. A bit like Facebook photo tagging. I'm not sure how I should approach this. I already took a look into Leaflet but it seems like it's too "map-centric" or do you think it'll work with plenty of single images?


It's probably the easiest way to explain the needs with a list:




  • The app has a lot of average high-res images instead of a few big map images




  • Store coordinates and data relevant to that mark in mongoDB (geoJSON?)




  • Not too hard to implement with responsive design (different image sizes)




  • Users should be able to set and select multiple marks cross-platform




Here's an example of how a single image could look like: http://ift.tt/1FFXhPb


How would you approach this?


Bulk Download Images with Organization

I have a list of URLs (pretty much all image urls though some pdf) that I need downloaded. I have found a variety of options for bulk downloading and these would work but I need them to be organized by the directory they are listed as in the URL. For Example:


http://ift.tt/1wru0D5

http://ift.tt/1BHXjbY

http://ift.tt/1wru0Tk

http://ift.tt/1wru0To

http://ift.tt/1BHXjc2

http://ift.tt/1wru2dT


I would need to be organized like this:

Folder Sample1

image1.jpg

image2.jpg

image3.jpg

Folder Sample2

image1.jpg

image2.jpg

image3.jpg


I do have SFTP access but each directory is terribly organized and has image files mixed with other irrelevant files. Additionally, most of the batch scripts I have tried to create have had issues. When I did xCopy there was no way to figure out which files failed and when I did robocopy speed was compromised. Any suggestions on how I should go about moving forward. Existing software is preferred but I am fine with advice in how I should script this. I prefer not to have to install anything to access SFTP via command line but if that's the only option it is what it is.


Upload image xmlrpc Wordpress and assign a post_parent

I am using wp.uploadFile to upload an image, once climb need to assign a post_parent, DO NOT seek to be added as a featured picture, but it is assigned the ID of the post where he was raised.


If I add as outstanding image then edited the post at the wp_posts table and post_parent field is 0.


I tried this:



include_once('IXR_Library.php');

$client = new IXR_Client('http://ift.tt/1Bn1FDQ');
$username='demo'; $password='demo';

$content = array(
'post_status' => 'draft',
'post_type' => 'post',
'post_title' => 'Title',
'post_content' => 'Message',
// categories ids
'terms' => array('category' => array(6))
);
$params = array(0, $username, $password, $content);
$client->query('wp.newPost', $params);
$post_id = $client->getResponse();

$content = array(
'name' => basename('http://ift.tt/1FFwe6H'),
'type' => 'image/jpeg',
'bits' => new IXR_Base64(file_get_contents('http://ift.tt/1FFwe6H')),
true,
);
$client->query('metaWeblog.newMediaObject', 1, $username, $password, $content);
$media = $client->getResponse();


And so



$content = array(
array(
'name' => basename('http://ift.tt/1Bn1Leq'),
'type' => 'image/jpeg',
'bits' => new IXR_Base64(file_get_contents('http://ift.tt/1Bn1Leq')),
'overwrite' => true,
'post_id' => $post_id
)
);
$client->query('wp.uploadFile', 1, $username, $password, $content);
$clientResponse = $client->getResponse();
print_r($clientResponse);


The first code uploads the image but not assigned to the post and the second gives error "Array ([faultCode] => 500 [faultString] => Could not write file (Empty filename))"


Any idea? Thanks.


PHP strings connect to Image

I have a php file that reads data from mysql database. Can i link from string example: Id:1, Name: Ivan, Ivan="image source"? So can i link a string to a image source in my php, so i can use both data and picture in android studio?


this is my table:



{
"Grad":[
{
"id":null,
"datum":"29.03.2015",
"grad":"Pula",
"place":"Zen",
"adresa":"Zaobilaznica 3",
"Dogadaj":"Narodna glazba i DJ Koprena",
"Cijena":"Besplatno"
},
{
"id":null,
"datum":"29.03.2015",
"grad":"Pula",
"place":"Pietas",
"adresa":"Riva 13",
"Dogadaj":"Narodna Glazba i Dj Sale",
"Cijena":"Besplatno"
},
{
"id":null,
"datum":"29.03.2015",
"grad":"Pula",
"place":"Uljanik",
"adresa":"Monte Zaro 11",
"Dogadaj":"Rostiljarka",
"Cijena":"10 kn i pivo gratis"
},
{
"id":null,
"datum":"29.03.2015",
"grad":"Zminj",
"place":"The Bar Zminj",
"adresa":"Ulica Bartulja 2",
"Dogadaj":"Night Express Band",
"Cijena":"30kn"
}
],
"success":1
}


So i want to put for string place: Zen i want to display image from Zen folder, image Zen.jpg.


Python Numpy - Image Array - Re-Order Rows

I would like to re-order the rows of an image. Is it possible to do this.


Ideally I would like to place each row to its nearest neighouring row with the closest amount of pixels. I am trying to solve a cryptic puzzle.


Its jumbled rows of an image which should be some text. I dont yet know the algorith they have used to crypt this therfore a start with the above would be ideal.


Would appriciate any help, cheers.



a = Image.open("NEW.png")
a = numpy.array(a)

#re order the rows here

#save sorted image and display
a = Image.fromarray(a)
a.save("SORTED.png")
#a.show()

Skin probability of a given pixel of a image

Given RGB value's of all pixels of a image , how can we find the probability that the given pixel is of skin color and what percentage of the image is of skin color .


ABCPDF Position of image in center of page

I Use AbcPdf, when I export HTML with images to pdf I use css to positioning image into center of page



<div class="alignToCenter">
<%foreach (var item in images)
{%>
<div style="padding-left: 5px;">
<div style="page-break-before:always">&nbsp;</div>
<img src="<%= @"data:image/gif;base64," + item.ToString() %>" />
</div>
<%} %>
</div>


here is alignToCenter css



.alignToCenter{
height:100px;
/*background-color: red;*/
text-align: center;
position: absolute;
top:0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
}


Now I want to add images using XImage



foreach (var item in exportPhotos)
{
theDoc.Page = theDoc.AddPage();
XImage image = new XImage();
image.SetFile("path"+ item);

theDoc.Rect.String = image.Selection.String;
theDoc.HtmlOptions.PageCacheEnabled = false;

int theID2 = theDoc.AddImage(image);

while (true)
{
theDoc.FrameRect();
if (!theDoc.Chainable(theID2))
break;
theDoc.Page = theDoc.AddPage();
theID2 = theDoc.AddImageToChain(theID2);
}
}


images is added but I need to display in center of the page,.. and if the Image is very big then I need to resize image


Image rotation based on PCA in Matlab

I'm working with an image of an array where we on one side has added an extra row, this in order to make the data scatter greater in one direction. Now I want to rotate the image I my idea is to use PCA. I started off with preprocess the image, segment it and then I only keep the array part for the PCA.



[I, J] = find(ims);
mat = [I, J];
covariance = cov(mat);
[eigvect, eigval] = eig(covariance);
% Chose the eigenvector with highest eigenvalue
if (max(eigval(:,1)) > max(eigval(:,2)))
v = eigvect(:,1);
else
v = eigvect(:,2);
end

v1 = v./norm(v,1);
v2 = [0,1];
%Calculate angle
angle = acosd( dot(v1,v2) / (v1 * norm(v2)) );


My questions are:



  1. Is it better to use the original grayscale image and perform the PCA on it rather than the binary image?

  2. Am I wrong using cov instead of pca? My chose is based on the fact that I will eventually change to openCV and implement everything in a smartphone application so I want to use methods that I can find in openCV too.

  3. Why do I get two angles when I only want the angle between the eigenvector and the vertical vector [0,1]?

  4. Do you think I should add an extra element to my array in order to increase the difference in how the data is spread?


Thanks for your time :)


Can't draw an image in Graphics2D

I'm making a video of handwriting. For that, I create images of the correspondent text at a given time. All images should have a background image like this:background image


So I've got this code to add this image before I add the text:



File srcImg = new File("maskTEXT2.png");
BufferedImage img = ImageIO.read(srcImg);
java.awt.Image tmp = img.getScaledInstance(WIDTH, HEIGHT, java.awt.Image.SCALE_SMOOTH);
graphics.setBackground(Color.WHITE);
boolean x=false;
while(!x){
x= graphics.drawImage(tmp, 1, 1, null);
}


graphics is a Graphics2D object. I printed the size of the image (img and tmp) and it isn't -1 so the image is loading correctly.


When I run the program all images are saved like this:image generated


Add base64 image to another image in PHP

I'm creating dynamic image in PHP with this:



$image = imagecreatetruecolor(708, 500);


Then I add some customization, background color, watermark text...



imagefilledrectangle($image, 0, 0, 708, 500, $whiteColor);
imagettftext($image, $fontsize - 3, 0, 400, 500 - $fontsize + 3, $infoColor, $fontfile, $info);


And finaly save the file:



imagepng($image, "test.png");


Everything works well, I get that test.png with white background, watermark, everything.


But this PHP file also receive POST values from JSON, one of them is base64 image. I know I can use something like that:



$stringImage = imagecreatefromstring(base64_decode($data->image));


But I don't know how to embed that posted image to my dynamicaly created image. Is that even possible?


Note: yes, base64 image is valid image


How to download image using WebClient.UploadString method?

I want to get image by sending json data to API. I use WebClient to download image.



string URI = "http://my_api.com";
string myParameters = "{'my': 'json_object'}";

using (WebClient wc = new WebClient())
{
wc.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
string HtmlResult = wc.UploadString(URI, myParameters);
}


UploadString method's return type is string. How can I convert this result to ContentType: image/jpeg ?


Session not Generated in my facebook sdk Api after Login

Hello i am using facebook sdk version 4.0 for post image but after login in facebook for image post its not generated session.



if($session) {
try {
// Upload to a user's profile. The photo will be in the
// first album in the profile. You can also upload to
// a specific album by using /ALBUM_ID as the path
$response = (new FacebookRequest(
$session, 'POST', '/me/photos', array(
'source' => new CURLFile('banner.png', 'png'),
'message' => 'User provided message'
)
))->execute()->getGraphObject();

// If you're not using PHP 5.5 or later, change the file reference to:
// 'source' => '@/path/to/file.name'

echo "Posted with id: " . $response->getProperty('id');

} catch(FacebookRequestException $e) {
echo "Exception occured, code: " . $e->getCode();
echo " with message: " . $e->getMessage();
}
}
else
{
echo '<a href="' . $helper->getLoginUrl() . '">Login with Facebook</a>';
}


Here when i login in facebook i got one blank page and my url generated like bellow



http://ift.tt/1MYlcyU


Please help me for solved this problem . Thanks In Advance.


how to convert bitmap to pencil sketch bitmap in android

i am trying to convert Bitmap to Pencil sketch.


I tried JHLabs for it. but i don't know how to use it in Android.


is there any tutorial available for this problem then please foreword me that link.


Reference an image in BitBucket readme.md

I have stored readme.md file and an image file in a BitBucket repo as follows:



  • readme.md

  • images/

    • scheme.jpg




I reference the image from readme.md as follows:


![Scheme](images/scheme.jpg)


Can I somehow reference the image from readme file so that it renders when viewed in BitBucket? In tutorial there is only http link way.


Android BitmapFactory.decodeResource takes too much memory

Welcome, I have question about loading Bitmap (in my case from resources). My code:



public void onClick(View view) {
if (mainButton == view) {
Bitmap bm = BitmapFactory.decodeResource(getResources(), R.drawable.test);
}
}


The test.jpg image resolution is 3288 x 4936px. It is jpeg (3,9MB / 48,7MB when uncompressed). While this function work (on my Nexus 7 2013 device), following exception occurs:



java.lang.OutOfMemoryError: Failed to allocate a 259673100 byte allocation with 5222644 free bytes and 184MB until OOM
at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:609)
at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:444)
at android.graphics.BitmapFactory.decodeResource(BitmapFactory.java:467)
at android.graphics.BitmapFactory.decodeResource(BitmapFactory.java:497)
at pl.jaskol.androidtest.MainActivity.onClick(MainActivity.java:50)
at android.view.View.performClick(View.java:4756)
at android.view.View$PerformClick.run(View.java:19749)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)


Why application tries to allocate as much as 248MB? I wrote similar application in Qt for Android with the same image in resources and it works OK.


EDIT:




  1. I can not resize it.




  2. This is very simple application, like hello world. It does nothing else, just loads bitmap from resources.